Is my a/b testing tool (e.g. Optimizely) slowing down my site?
No. It’s not. Your shitty variation code is.
But just in case you’re not convinced, I’ve written a simple little script to help you find out if your tool is in fact “hurting your conversion rates.”
This snippet of code will give you the answer
Below is an easy way to determine whether your a/b testing tool is slowing your site down to the point of hurting your conversion rates. Keep in mind that tools like Optimizely load at ~100ms (the first time around), so the likelihood of the tool in itself causing a noticeable slowdown are slim-to-none, unless you’re on dial-up or on an Amtrak train.
The snippet below is to help answer the question, “Is the script slowing my site down to the point of hurting conversion rates?” That means you should archive all experiments if you want a true answer. It’s to test the snippet on its own, without being affected by your variation code.
You’ll probably want to put this right after your Google Analytics code (although typically you would place your testing snippet higher up).
Disclaimer: this is a use-at-your-own-risk snippet. It is in no way endorsed by any real developers — YET. I hope to get some comments that will make this thing better.
To reduce clutter, I recommend adding this in as an external script as such:
What does it do?
- Picks a random tool from a custom list. There’s an array in the snippet that has a list of tool options. In this case, I’ve put “no tool” and “Optimizely” as the two options. For the Optimizely option to work, you’ll need to enter your project ID. If you wish to replace/add an option, let me know, I can make it happen. I did this quickly to get the post up and if it’s worth my time, I’ll add other options.
- Creates the snippet for the tool (or not if “none” is randomly chosen). This goes into the top of the <head>.
- Sets a user-level custom dimension for Google Analytics. You’ll want to set the dimension up and be sure to rename the one in the snippet accordingly.
- Sets a persistent cookie so that the same thing happens for that user throughout their visit and subsequent visits, for as long as they don’t delete their cookies.
Is this useful in anyway? Let me know! Ways to make it better, feel free to collaborate: https://github.com/alhankeser/toolswitcher