Skip to main content

Migration Guide for the Custom Embed from V1 to V2

KnoCommerce always requires our script to be embedded on the page where you are displaying surveys. For non-Shopify stores or custom survey implementations on a webpage of some kind have historically required manual setup.

Updated this week

For these manual setups, we built an updated version of that script, which will improve efficiency and performance within the custom survey experience. We intend for this migration guide to resource you and/or your engineering team to perform this migration quickly and smoothly.

Version 2 Improvements from Version 1

As we continually develop and improve KnoCommerce to keep pace with the changing environment, we’ve made some very broad yet crucial updates in the second version.

The primary change we’ve made is decrease the size of the embed file by almost 50%, which improves the load time of the script and consequently has decreased the time to render the survey to the user as well.

Secondly, we’ve updated and improved the styling and the aesthetics of the 2nd version of the survey embed script.

Instructions

Updating the custom embed version from V1 to V2 is a straightforward process.

First, identify where the script is located within your codebase. It could be in a number of places, a few examples of which are located below:

  1. A Thank You page

  2. An Order Status page

  3. An Order Confirmation page

  4. Google Tag Manager script

  5. Landing page elsewhere on the site

You will be searching for the script tag for the V1 embed, which looks like this:

<script src="<https://www.knocdn.com/v1/embed.js?id={{accountId}>}"></script>

Second, you’ll need to make the change to migrate your surveys to V2 of the embed. The update itself is quick. In the script tag, you’ll only need to change v1 to v2. See the updated script tag below:

<script src="<https://www.knocdn.com/v2/embed.js?id={{accountId}>}"></script>

Third, it would be best to review the new survey experience to ensure all of your survey features and functionality are continuing to work as expected. To assist in this, we’ve included a list of known breaking features that will require updates within your survey setup in the KnoCommerce app when switching from v1 to version 2.

Required Updates to Survey Implementation

The primary change that will require updates are to surveys that were implemented with Custom CSS. KnoCommerce gives the opportunity to insert Custom CSS through a field within the Survey Builder in the KnoCommerce App.

This example shows the difference in CSS needed to change the color of the Title to Blue. To fully migrate from Version 1 to Version 2, you’ll need to update any surveys that currently utilize the Custom CSS field (this is survey-specific).

To check if your survey is affected by these changes, you’ll need to do the following:

  1. Go to the Surveys Page in your KnoCommerce App account.

  2. Click the survey that you’d like to check

  3. In the top right-hand corner, click the Edit button to enter the survey builder.

  4. Look in the Custom CSS field (may need to scroll down to find the field in the Design section)

  • Blank Custom CSS fields indicate nothing has been customized. Nothing to worry about!

  • If CSS exists in the field, you’ll need to coordinate with your technical team to ensure the migrated/updated experience looks the way that is expected for your brand.

Examples

HTML File

The window.Kno data object does not require any updates. The only update needed is the versioning within the actual script tag.

<html>
<div>
<div id="additional_scripts"></div>
</div>
<script>
window.Kno = {
"kno_id": {{ kno_id }}
"customer": {
"platform": "CUSTOM",
"shop": "example-shop.com",
"email": "{{ email }}"
},
"order": {
"id": "order_1234",
"total_price": 100.00,
"currency": "USD",
},
"survey": {
"id": {{ UUID }},
"selector": "#additional_scripts"
}
};
</script>

<script src="https://www.knocdn.com/v2/embed.js?id={{ account_id }}"></script>
</html>
```

Google Tag Manager

Find the Tag that has the Kno Script in it.

Running into Trouble?

If you’re having a difficult time with any part of this migration, please check out our FAQ Document here.

If you’re still having issues, please reach out to our Support team through our chat or by emailing hello@knocommerce.com. Include as much context as possible, and we’ll do our best to provide quick and specific solutions to the problems that you’re running into.

Did this answer your question?