Overview
If your organization already uses Google Tag Manager (GTM), installing KnoCommerce surveys through GTM is a flexible and scalable option—especially for multi-site teams or marketers looking to manage tags without directly editing code.
This guide walks you through the basic installation and setup using GTM variables and tag configuration.
This guide covers the base embed setup. For advanced options (like passing order or customer data), refer to the Universal Embed Script documentation.
Setup Guide
1. Create GTM Variables
In Google Tag Manager, create the following user-defined variables:
kno_account_id
This is your Account ID used in the embed script URL.
kno_integration_id
This is your Integration/API Key, found under Settings → Integrations → Custom in KnoCommerce.
You can also define optional variables for:
your_domain_variable
(e.g., yourstore.com)customer_email_variable
customer_lifetime_orderspend_variable
customer_lifetime_ordercount_variable
your_order_id_variable
your_order_total_variable
2. Create the Kno Embed Script Tag
In GTM, add a new tag with the following configuration:
Tag Type: Custom HTML
Tag Name:
KnoCommerce Survey Embed
Paste the script below into the HTML editor, updating each {{ }}
reference to use your defined GTM variables:
<script>
window.Kno = {
kno_id: {{kno_integration_id}}, // API key from KnoCommerce
customer: {
platform: 'CUSTOM',
shop: {{your_domain_variable}},
email: {{customer_email_variable}}, // required if no phone
lifetime_spent: {{customer_lifetime_orderspend_variable}},
lifetime_orders: {{customer_lifetime_ordercount_variable}}
},
order: {
id: {{your_order_id_variable}}, // required
total_price: {{your_order_total_variable}},
currency: 'USD'
},
survey: {
selector: 'div#before-additional' // must match an element on your confirmation page
}
};
</script>
<script src="https://www.knocdn.com/v1/embed.js?id={{kno_account_id}}"></script>
3. Set Up a Trigger
We recommend using a Page View trigger configured to fire only on the Order Confirmation Page.
Trigger Type: Page View
Conditions: URL contains or matches your confirmation page path (e.g.,
/order-confirmation
)
How To Test
Once your settings are saved, here's how you can test:
Use GTM’s Preview Mode to ensure the tag fires correctly on your confirmation page
Confirm the survey renders in the selected element (e.g.,
div#before-additional
)If no survey appears, confirm that the
kno_id
, embed script, and selector are all correct
Support
If you need help identifying GTM variables or configuring your setup:
📩 Email: hello@knocommerce.com
💬 Live Chat: Available in the KnoCommerce dashboard
Happy surveying! 🎉