1

This is a cross post from https://stackoverflow.com/questions/40544132/google-analytics-experiments-with-ajax. I though it is better to dicuss it here.

I would like to integrate google analytics experiments to our website.

My situation: We have a solution for feature toggles, that also allows A/B testing. The features are stored in the database and have a percentage that defines how many users will see the feature. We also store the features in a cookie, so the users will see the same view when he refreshs the page.

Now I want to use server the javascript API to track the state of the feature (Google Experiments Documentation). In my understanding I have to send a request to google whenever an experiment is used and I also have to tell google the ID of the alternative. It must happen on the right page to correlate the experiment with the right page view. The problem are ajax requests which might check the split tested features. In this case it is hard to say which features are used for the current page.

I see 3 options:

  1. Track all experiments, even if they are not used on this site. (I think it does not make a lot of sense)
  2. Make a tool/configuration to define the experiments and feature toggles that are used on each site (very easy to make mistakes here).
  3. Track the experiments from server-side code (but I don't know how GA will connect these calls to a page view).

What is the official guideline for ajax requests and google analytics experiments?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.