If you're already using Google Tag Manager for your organization, installing your post purchase survey script via GTM might be the best approach for your organization.
To start we're going to create two new variables in GTM.
Create your "kno_account_id" variable.
Create your "kno_integration_id" variable.
Create your Kno Embed Script Tag
The last step is to create your tag and display it according to your chosen triggering criteria.
Copy the script below, and replace the variables with your own GTM variables. This is just the base install. You can reference the universal embed page for all available script parameters including customer and order data for advanced reporting and survey targeting.
<script>
window.Kno = {
kno_id: {{kno_integration_id}}, // this is the API key found in the "custom" integration
customer: {
platform: 'CUSTOM', // required. Accepts CUSTOM, WOOCOMMERCE, etc.
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. Must be a string.
total_price: {{your_order_total_variable}},
currency: 'USD',
},
survey : {
selector: 'div#before-additional' // required. Any element
}
};
</script>
<script src="https://www.knocdn.com/v1/embed.js?id={{kno_account_id}}"></script>
For triggering, we recommend using page view targeting and setting the targeting to your order confirmation page.