Rich-text Reply

Tracking Custom Goal iframes

djarsoftware 04-13-15
Accepted Solution

Tracking Custom Goal iframes

Hello Everyone,

 

I want to track a custom goal on a page that has a popup iframe.  I have the Optimizely code snippet on the iframe page and setup the custom goals in the experiment.

 

window.optimizely = window.optimizely || [];
$("#from").bind("mousedown", function() {window.optimizely.push(["trackEvent", "mixergy_gate_original_page_email_input_click"]);});
$("#name").bind("mousedown", function() {window.optimizely.push(["trackEvent", "mixergy_gate_original_page_name_input_click"]); });
$("#leadpages-submit-button").bind("click", function() {window.optimizely.push(["trackEvent", "mixergy_gate_original_page_submit_button_click"]); });

 

When I use the Optimizely preview and test out the custom goals the custom goals work.  See the image below.  I have the experiment running but I am not seeing the custom goals being register for the iframe.

 

Any ideas why the custom goals are not registering?

 

Just let me know.

 

Thanks

Chad

 

ScreenShot2a.jpg

 

 

srehm 03-03-15
 

Optimizely tracking goals (iframe)

Hi all,

 

I have a Website (Website A) and in the right sidebar we have an iframe (hosted on Website B) that is our contact formular.

 

Now I want to make a/b tests on website A and track the conversions made by the contact formular.

 

How do I do that? I can't put the Click-Goal on the iframe (when being in the experiment on website A).

 

Is it somehow possible to connect the two? So that my results on my test on website A will track how often the contact formular-button has been clicked?

 

Thank you!

Level 2
greg 03-03-15
 

Re: Optimizely tracking goals (iframe)

[ Edited ]

Hey,

 

Do you have control over Website B? If so, you might be able to do it this way:

 

  1. Make sure the optimizely snippet is on Website B.
  2. For your click goal, click the Advanced Settings and enter a selector to choose which element to track. Set Website B as the Goal URL instead of using the default "use experiment settings" option.
Level 2
Amanda 04-14-15
 

Re: Tracking Custom Goal iframes

Is there any chance you can post the URL where the experiment is running? That would be very helpful! Thanks Smiley Happy
Optimizely

Re: Tracking Custom Goal iframes

[ Edited ]

Here is the URL: http://mixergy.com/welcome/

Thanks
Chad

Amanda 04-14-15
 

Re: Tracking Custom Goal iframes

Hey @djarsoftware - There are a few issues going on here: 

 

1. For some reason it appears that jQuery is not defined on the page. I recommend viewing the JavaScript settings on your dashboard, clicking the option to load trimmed version, saving, and then clicking the full version again and re-saving. This should force the snippet to update and load the jQuery as expected. (see attached screenshot below)

 

2. You experiment's URL targeting conditions do not allow your experiment to run on the iframe URL, which means the custom event code is not executing there. The iframe URL looks to be http://truemind.leadpages.net/leadbox/14621c073f72a2:14dad5d56b46dc/5658702627471360/?lp-in-iframe=1... but when you enter this into the URL validator, it does not match. You should adjust your URL settings so that it's applied to the iframe URL. (see attached screenshot below)

 

3. You could also add your custom event code directly to your site's HTML so that the code is triggered on the success event of the form submission on the iframed modal. This would avoid the URL targeting issue you're running into in #2 above. 

 

Can you let me know if the above changes do the trick for you? If you're still running into issues getting the jQuery to properly load, we can open up a support ticket for you. 

 

URL targeting: 

Screen Shot 2015-04-14 at 10.36.45 AM.png

 

jQuery is not defined: 

Screen Shot 2015-04-14 at 10.35.55 AM.png

Optimizely

Re: Tracking Custom Goal iframes

Hi Amanda,

 

Adding the iframe URL to the targeting conditions seems to have done the trick.  I am going to double check the data in morning.  If there is still an issue I will let you know in this thread.

 

Thank you for all the help.

 

Chad