2

I'm working on the website maisonfribourg.ch which was developed using grav.

I'm trying to track form submissions using GTM. In the attached image you will see a blue-colored button, clicking it brings up a pop-up: Screenshot showing the "Download the Brochure" Button.

The developer says that the site is using dataLayer.push to include the following elements in the data layer: requestFile : open
requestFile : sent

These elements track the opening and the sending of a contact form , respectively. I will start by describing how I'm trying to track the OPENING of the form. I wish to track both of these actions using GTM, i created a Variable named 'requestFile' so that GTM would be aware that this is an item I'm interested in. The variables and triggers I created

I created a trigger , based on a Custom Event Finally, I created a Tag for It Here's an image of the final result The debugging console shows that the custom event is being pushed into the datalayer

So I believe the debugging console shows that a Data Layer element exists, but somehow no tags are being triggered, not even the Universal Analytics one.

What am I missing? Have I misconfigured something?

Thank yo in advance for your help

1 Answer 1

1

DataLayer variables aren't looked at for Custom Event triggering. You'll need a different syntax to get your event to fire.

The GTM custom event documentation has an example similar to what you are trying to do. To trigger a custom event and also capture open/sent, you'll need 2 things pushed into the dataLayer.

Your variable is correctly set up to capture the value "open" or "sent", but you also need a dataLayer entry like

'event': 'ContactForm'

Then your custom event trigger would have Event Name of ContactForm but still be scoped in to when requestFile contains open.

However, do you need custom events to track this? You can use link and button clicks and form submissions as event triggers as well. Provided you can specify the buttons used to open and submit the contact form (or the form itself, for form submission) with CSS, that may be an easier way to set up tracking.

1
  • Hi @Reve Thank you for answering the question. I will follow the suggestions on the link. We ended up tracking the form submission via the "Thank You" message (CSS element tracking, like you suggest) Thank you once again for your help May 13, 2020 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.