Upgrading from Clerk.js 1 to Clerk.js 2 See the steps you need to take to get the faster and more flexible Clerk.js 2 Stefan Lorenz Olsen
However, since the two versions work slightly differently, you need to follow these steps to successfully upgrade.
The two main differences in Clerk.js 2 is:
The script must be inserted just before the </head> tag in your webshops template.
Step 1: Converting Designs
Since Clerk.js 2 has a different approach Designs, you need to create new ones.
You can create your Clerk.js 2 Designs in one of two ways:
1. Use the intuitive Design Editor to create new Designs, as described in the following points.
2. Convert your old Designs. Follow this guide to see how to do it.
1.1 Start by going to my.clerk.io -> Recommendations / Search -> Designs and click New Design:
1.2 On the following screen, give your Design a Name (we recommend adding "V2" so its obvious that you are using Clerk.js2).
1.3. Choose Type: Website, Version: Clerk v2 and select a Prepared Design depending on whether you are creating a Search or Recommendations Design.
1.4. When you are done, click Create Design
1.5. In the Design Editor, click any of the existing elements like the name, image, button etc. to edit it, or drag-and-drop new elements to the Design to add more information about products.
1.6. Click Save Design when you are done, and go to Step 2 in the guide.
1.7. Lastly, go to Recommendations / Search -> Content and change your Clerk.io Content to use your new Design.
1.8. Click Update Content. This will temporarily cause them to not show up on your webshop, until you are done with Step 2. Choose the new Design for all Content that should be updated.
1.9. There! You are now ready to switch over to Clerk.js 2.
Step 2: Replacing the script
2.1. Start by locating the template file that is used to show all pages of the webshop, and where the original Clerk.js script is found near the bottom.
2.2. Remove the old script from the file:
2.3. Next go to my.clerk.io -> Settings -> Tracking Code. This page now contains your Clerk.js 2 tracking code.
2.4. Copy this code and insert it just before the </head> tag in the template:
2.5. Save your template.
Congratulations! You are now running on the much-improved Clerk.js 2 setup!
You can see the full documentation for Clerk.js 2 here: https://docs.clerk.io/docs/clerkjs-quick-start