Split Testing and Netlify Identity

We’ve recently setup Split Testing on one of our project. The two branches being served are main and test-product-header-video

The problem is that it seems if our CMS editor (We’re using NetlifyCMS) attempts to log in they are redirected to sometimes redirected to: https://test-product-header-video--transposit.netlify.app/#access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6Ik...

It seems Netlify while serving the search branch, sends them to the branch URL for access_token validation rather than the main branch.

Is there anything we can do to enforce the production URL when login in from identity.

And also, how can we direct our editors to temporarily get out of this situation, as clearing the cache does not seem to do it.

Thanks a lot!

Hi, @regisphilibert. The only workaround for this would be to change the nf_ab cookie the editor is sending to Netlify. Now, I considered that you my try adding site javascript that detects the user and set nf_ab to a known value for the production branch. However, to do that the user would need to already be logged in.

So, the only workaround that remains, would be for the CMS editor to manually edit the cookie in devtools. The trickiest part is knowing what cookie to set. You can test this with trial and error.

I took a look at the split test for your site and anything over 0.5 (the values are 0 to 1) will return your production branch. Here is a screenshot to show where to change the cookie:

If there are other questions about this, please let us know.

Thanks it’s kind of helpful but I’m not sure I’m confortable using Netlify A/B testing solution in conjonction with Netlify Identify if this is the “workaround” I need to present to them.

If there are other questions about this, please let us know.

Are you going to fix it? :smiley:

Hey there!

You may be able to introduce an internal proxy rewrite that forces the main branch to be served when navigating to your admin login page. It would look something like:

/admin https://main--transposit.netlify.app 200!

You might be able to combine this with a cookie presence parameter.

That may be a possible solution and I would be interested to hear if it works for you. Otherwise, unfortunately, our Split Testing product is in Beta and we are still taking valuable feedback (such as this) before we consider re-vamping and enhancing the product. However, please do let me know if this helps.

We stopped the A/B test. But I’ll definitely give it a try next time we do one! Thanks @Scott

1 Like