Rich-text Reply

adding iframe for cross domain tracking help

baconisthebest 01-29-15

adding iframe for cross domain tracking help

So I am trying to track a page view goal.


My experiment is running on but my page view goal is on


I read the help article on adding a hidden iframe as a wordaround, but I'm still confused on how to implement it exactly.


My sites are both running on Wordpress if that makes a difference.


So do I put  put an iframe for on And how does the code look? Does it look exactly like it's written out on the image on this page - ?





greg 01-29-15

Re: adding iframe for cross domain tracking help

What you do is create a new page on that is completely blank except for the code shown in the example (just substitute your own project code). For this example, let's say you call that page /confirmation.


Then you set your pageview goal to


Now on the real destination page (, you have to load so that the pageview goal is triggered, but you want do it in a way that doesn't affect what is actually shown on So on the real destination page of, you add this code:


<iframe style="display:none" src=""></iframe>


Just update the bold part. The display:none style makes this iframe invisible, so that it doesn't affect how the page on looks.


Does that help?



Level 2
Brian_Abad 01-29-15

Re: adding iframe for cross domain tracking help

Just to piggy back on Greg's reply, you'll also want to implement the Optimizely snippet on the page.

What happens is that once a user is bucketed into an experiment, Optimizely keeps a log of all the URLs that the user lands on that contain the same Optimizely snippet moving forward. So if a user gets bucketed into an experiment on and navigates to -- if has the iframe, then Optimizely will be able to log the page as it contains the snippet and the user presumably is bucketed into the experiment at that point.

Let me know if any of that is unclear!
Brian Abad
Manager, Technical Support
Customer Success

Re: adding iframe for cross domain tracking help

Thanks do i put the optimizely snippet on both and
Amanda 01-30-15

Re: adding iframe for cross domain tracking help

[ Edited ]

You'll want to add the snippet on Site 1 **AND** in on the blank Site 1 page that is iframed on Site 2. That will allow the Optimizely actions to be tracked across both sites. Does that help? 


We actually have a great article that provides quite a lot of detail on this as well as some helpful images: