Created
January 14, 2022 17:00
-
-
Save chriswagoner/34ddb40bbb93269bb0121de08058ad96 to your computer and use it in GitHub Desktop.
Get Query Parameter and throw it into a form field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here we are targeting a Hubspot form, grabbing the GCLID (from a Google ad click) and popping it into the hidden Hubspot field value that has the ID of GCLID. | |
jQuery(".hs-form").submit(function() { | |
ga(function() { | |
if (jQuery('#gclid').length) { | |
jQuery("#gclid").val(ga.getAll()[0].get('_gclid')); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment