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.

  1. Go to the GTM workspace

  2. Create a new Tag

  3. Click on Tag configuration

  4. Choose Custom HTML

5. Add the following JavaScript snippet:

var email = document.querySelector(«XXX»).value
sw("send-form-submit", {email: email });

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 querySelector you can also use other Document methods such as getElementById, getElementByClass 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

Did this answer your question?