Rich-text Reply

Page loadtime as custom event goal

SuperSecretUser 11-25-15

Page loadtime as custom event goal

Hi,

 

This is just a general question, i have a request from client to measure the page loadtime for original and variation page just so we know if the test impacts our performance. So I want to set up a custom event goal to track load time on both original and variation pages use the following code.

 

var start = (new Date()).getTime();
$(window).load(function() { var end = (new Date()).getTime();
var loadTime = (end-start)/1000;
});

I have set a custom event goal and set the eventName to loadTime, after adding these two lines of code to Experiment Javascript, what do I next? 

 

window['optimizely'] = window['optimizely'] || [];
window['optimizely'].push(["trackEvent", "loadTime"]);

 

I am a bit confused by the concept as where to add code and how it tracks the goal. Do I need to have a method call named the same as event name, or what do I need to do to make sure it's tracked? And do i also add all the js in Experiement JavaScript? Any help is appreciated!

MartijnSch 11-26-15
 

Re: Page loadtime as custom event goal

Hi!

What kind of tracking methods are you using for web analytics? Because you might also be able to already implement this within your current set up. If you would go with Google Analytics and set up custom dimensions then you would be able to drill down your site performance based on the test variants that will be send through Optimizely to Google Analytics.
robertchan 11-30-15
 

Re: Page loadtime as custom event goal

Agreed with MARTIJNSCH, you can simply set up a custom dimension in Google Analytics. First integrate with GA (https://help.optimizely.com/hc/en-us/articles/200039995-Integrating-Optimizely-with-Google-Universal... then within an experiment go to Integrations and tick off Google Analytics. Add the index number for the experiment based on whatever you set your custom dimension's index to within GA. Finally, within GA, you can set the metrics (one of which is a page's load time). Once the experiment's launched, just wait a few hours to a day for information to propagate from Optimizely into GA.
Robert Chan