How to implement special customizations with GTM ?
If form tracking doesn’t work with the standard SalesWings template in GTM, we recommend that you create a form submission handler in GTM and then use this handler to send form-submission events.
Go to the GTM workspace
Create a new Tag
Click on Tag configuration
Choose Custom HTML
5. Add the following JavaScript snippet:
<script>
var emailElement = document.getElementById("XXX");
if (emailElement) {
var email = emailElement.value;
if (email) {
sw("send-form-submit", {
email: email
});
}
}
</script>
6. Replace “XXX” with the identifier of the email-address field of the form in question. The identifier can be any one of the following:
field id
field name
CSS selector etc.
In addition to the method getElementById you can also use other Document methods such as querySelector, etc.
How to find the attribute-name of the email-address field ?
Go to your website
Open the page where the form that you want to track is located
Open Developer Tools
Inspect the relevant email field
Copy the name of the attribute
6. Go to Triggering
7. Choose Form Submission trigger as a type
8. Save your tag
9. Don’t forget to Submit all your changes