This JavaScript module handles UTM parameter tracking and cookie management for marketing attribution on The Happy Car Club website. It automatically captures UTM parameters from URLs, manages their persistence through cookies, and integrates with Webflow native forms to pass UTM data to Vonigo.
- Captures standard UTM parameters from URLs:
- utm_source_platform
- utm_id
- utm_source
- utm_medium
- utm_campaign
- utm_term
- utm_content
- Also tracks:
- gclid (Google Click ID)
- fbclid (Facebook Click ID)
- Stores UTM data in cookies for persistent tracking
- Maintains existing UTM data when new parameters aren't present
- Automatically sets cookies for the
.thehappycarclub.com
domain - Provides functions for:
- Setting cookies
- Reading cookies
- Managing UTM parameter persistence
- Automatically detects Webflow forms with Vonigo endpoint
- Appends UTM parameters to form submissions
- Works with native Webflow form handling
- No custom form building required
Add the script to your Webflow site's custom code section:
<script src="params.js"></script>
To test UTM parameter tracking:
- Clear existing UTM cookie:
document.cookie = "PPC Attribution Tracker=; path=/; domain=.thehappycarclub.com; expires=Thu, 01 Jan 1970 00:00:01 GMT;";
- Visit page with test UTM parameters:
https://yourpage.thehappycarclub.com?utm_source=test&utm_medium=test&utm_campaign=test
- Verify cookie data:
console.log(getCookie("PPC Attribution Tracker"));
The system automatically:
- Checks for UTM parameters in the current URL
- Updates or maintains existing UTM parameter cookies
- Integrates with Webflow forms pointing to Vonigo
- Appends UTM data to form submissions
- UTM parameters are only updated when new parameters are present in the URL
- Existing UTM data is preserved when no new parameters are detected
- Forms must have action URL containing "vonigo.com" to be detected