AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
2.6K members online now
2.6K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Experiments and ajax-loaded content

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I have some ajax-loaded content against which I want to run experiment. This content loaded not on all pages and its not clear is there will be this content or not.

I loaded 

api.js?experiment=EXPERIMENT_KEY

and do cxApi.chooseVariation() then 

ga('send', 'pageview');

for all pages , then wait for ajax-content loaded and change it according to chooseVariation() value .

So all pages counted as experiment's sessions (even if I have no ajax-loaded content so no variations applied) and this is not very good

 

This is not clean from documentation is experiment's session started on google's side  on api.js?experiment=EXPERIMENT_KEY load

or on ga('send', 'pageview') events.

 

Which s the best way to do GA experiments in my case?