How can you choose variations for several content experiments?

后端 未结 4 591
终归单人心
终归单人心 2020-12-29 12:21

I\'m using the Javascript API for Google Analytics Content Experiments and it seems like you have two choices:

  1. Run one experiment at a time and have Google ass
4条回答
  •  温柔的废话
    2020-12-29 12:50

    I solved this using a node.js script.

    Out-of-the-box Google Content Experiments makes you choose between:

    • Load cxApi patched only for 1 experiment
    • Load cxApi plain, and lose the ability to call chooseVariation() function, making you implement your own choosing algorithm (which is a shame, as google's multi-armed bandit idea is really smart).

    So I did some reverse engineering on how google cxApi js is patched for 1 experiment, it turns it out it just bundles the experiment info (the variations weights) in the middle of the file, I experimented touching the bundle manually adding multiple experiments, and now I can call cxApi.chooseVariation(experimentId) for each experiment, and works nicely!

    Weights change every 12hs, so I automated it, I created a node.js little app that will download cxApi from google, and then repeatedly download it for each experiment you specify, and patch a cxApi with all your experiments on it.

    Voila!, multiple experiments on any page.

    Here's the repo: https://github.com/benjamine/mutagen, fork at will

    this node.js app will patch cxApi for multiple experiments, and will also pack (and minify) your variations

提交回复
热议问题