Skip to content

Instantly share code, notes, and snippets.

// Pass Tracking Parameters to a Form on Another Page Using GTM
// https://zackphilipps.dev/posts/store-gclid-cookie-send-to-hubspot/
/**
* Assigns the supplied URL parameter to a cookie and each form field with a name that matches.
* You can keep calling this function multiple times for each URL parameter you want to pass along, e.g.
*
* window.onload = function () {
* assignTrackingParameterToCookie("gclid", "hubspot");
* assignTrackingParameterToCookie("utm_source", "gform");