Optimizely and Cloudflare
I'm trying to use Optimizely alongside Cloudflare but for some reason it doesn't seem to be allowing experiments to run. I've added the following before the Optimizely snippet <script data-cfasync="false" but cloudflare still appears to be preventing my site from running experiments. Are you aware of this issue? Does anyone have a solution?
Solved! Go to Solution.
Hi Ryan, Can you share the URL where you have the Optimizely snippet added so we can take a look and see if Optimizely is being defined properly? Also, can you provide more information on what you mean by "preventing" your site from running experiments? Are you seeing an error in the editor, or are you able to start your experiment, you just don't see the changes? Thanks!
Sure, the homepage is here: http://www.currentbody.com/ you can see the Cloudflare snippet on there too. I am able to start the experiments (I had 4 running), but once I had cloudflare running the experiments stopped. Let me know if you need anything else
Sorry, I'm not that familiar with Cloudflare. When I visit that URL I can see that there are 2 experiments running. Do you have to actually turn Cloudflare on outside of the snippet being there?
When did this happen to you? I want to make sure it wasn't because you went over your 50,000 visitor alottment for the month. If that happens, experiments will be paused.
Nope - you're right. I just wanted to double check. Very strange. I am going to open a support ticket to investigate this. If there's any way you could share a staging or sample page with both of these turned on, that might be helpful to debug. This might also be something that Cloudflare's team is better able to help with.
Just to confirm... You need to add that attribute TO the optimziely snippet, not before it.
The way you have it on the site right now is close, but the data attribute is backwards.
<script src="//cdn.optimizely.com/js/3320600494.js" data-cfasync="false">
<script src="//cdn.optimizely.com/js/3320600494.js" cfa-datasync="false">
It does need to be data-cfasync="false" and not cfa-datasync="false", and they state it needs to be placed before the 'src' attribute. We are trying a few things out so will update the post if we find a solution
@David-MannheimYou're right - I was lookign at some bad documentation.
To match the current documentation, the change you need to make is to position the data attribute before the src attribute, like this:
<script data-cfasync="false" src="//cdn.optimizely.com/js/3320600494.js">