-
-
Save measureschool/480ffdee9734cdda9a2f73d8123c66e2 to your computer and use it in GitHub Desktop.
This is a custom HTML tag for GTM that fills out a form field with the data provided by a variable
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
<script> | |
(function () { | |
var value = "{{cookie - __gtm_campaign_url}}" //fill with variable which information should be written into the field | |
var selector = "input[name='source']" //fill with CSS Selector that identifies the form field | |
var field = document.querySelector(selector) | |
if(field){ field.value = value||"(none)"; } | |
})(); | |
</script> |
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
<script> | |
(function () { | |
var value = "" //fill with variable which information should be written into the field | |
var selector = "" //fill with CSS Selector that identifies the form field | |
var field = document.querySelector(selector) | |
if(field){ field.value = value||"(none)"; } | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment