Skip to main content
All CollectionsPlatform SetupCustom Setup
Passing Click Data To Custom Script

Passing Click Data To Custom Script

Guide for associating survey responses with click data when not using Shopify.

Updated over a week ago

Overview

To better understand where your customers are coming from and how they found your site, KnoCommerce allows you to pass click data and UTM parameters directly into your custom survey script via the customer_journey object.

This enhances your survey analytics with valuable attribution insights—especially useful for analyzing first and last-touch marketing performance.


What Can Be Tracked?

The customer_journey object supports data from both the first visit and last visit of the customer. Each visit can include standard UTM parameters and a source.

Here’s a breakdown of the accepted keys:

First Visit (First Touch)

  • source

  • utm_parameters

    • source

    • medium

    • campaign

    • content

    • term

Last Visit (Last Touch)

  • source

  • utm_parameters

    • source

    • medium

    • campaign

    • content

    • term

Note: Both first and last visit objects are optional, and you can include only the fields that are available.


How to Add It to Your Script

Inside your order object in the KnoCommerce config, add a customer_journey object like this:

"order": {
"id": '200',
"total_price": 25,
"currency": "USD",
"customer_journey": {
"last_visit": {},
"first_visit": {
"source": "direct",
"utm_parameters": {
"term": null,
"medium": "shopping",
"source": "google",
"content": "Example content",
"campaign": "Shopping"
}
}
}
}

Key Notes

  • null values are acceptable where data is not available

  • If utm_parameters or any nested fields are omitted, the script will continue to function without error

  • If both first_visit and last_visit are empty or undefined, the customer_journey object will simply be ignored


🛟 Need Help?

For support or further clarification, feel free to reach out:

📩 Email: hello@knocommerce.com
💬 Live Chat: Available in your KnoCommerce dashboard

Did this answer your question?