Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- (function () {
- // Uncomment below line to show the hidden fields for debugging
- // document.querySelector('input[name="field[9]"').type = 'text';
- // document.querySelector('input[name="field[11]"').type = 'text';
- // Below would capture the query strings from the cookie
- var url = new URL({{cookie - __gtm_campaign_url}}),
- params = new URLSearchParams(url.search),
- utmSource = params.get('utm_source'),
- utmMedium = params.get('utm_medium'),
- fbclid = params.get('fbclid'),
- gclid = params.get('gclid');
- // Fill the hidden fields with the required query params
- // Change the selector or the variable name to send the required query params
- document.querySelector('input[name="field[9]"').value = utmSource;
- document.querySelector('input[name="field[11]"').value = fbclid;
- // Uncomment if you want to grab either FBCLID or GCLID & change the selector accordingly
- // document.querySelector('input[name="field[11]"').value = gclid || fbclid;
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement