This article will show you how to test Memberstack 2.0 while still running your site with Memberstack 1.0. We've created some code to dynamically load the correct version of Memberstack based on the current URL.
Before you start, it's important to note that you need at least 2 domains for this code to work. A production domain (e.g. netflix.com) and a testing domain (e.g. netflix.webflow.io).
1. Add Code.
1. Copy and paste this code into your Header code. Don't hit publish until the end of the article!
2. Update Code
Next, let's update the code snippet to work for our particular installation. You'll need to update 3 things...
1. In the code, update v1_memberstack_id with your Memberstack 1.0 ID. You can find the ID inside your existing 1.0 header script.
2. In the code, update v2_app_id with your 2.0 app ID. You can find he ID on the Settings page in 2.0.
3. Finally, update v2_url_contains with the domain or subdomain you want to use to test Memberstack 2.0. This could be a subdomain or a test domain.
var v2_url_contains = "testing.webflow.io"
3. Remove Old Code.
Before hitting publish, you need to remove the old Memberstacks install scripts. They look like this...
<!-- Memberstack -->
<script src="https://api.memberstack.io/static/memberstack.js?webflow" data-memberstack-id="888c1db997d6d6e5601e4d3ffc5f0ba9"> </script>
You can do this by commenting out the script, or removing the script altogether. I recommend removing it to keep things clean.
4. Save & Publish your site.
After you publish, your testing domain should load the 2.0 script (and look broken) and your production domain should continue to load the Memberstack 1.0 script.