Hey everybody,
Thanks for taking the time to read this message.
I’ve been pulling my hair out trying to get Custom JS to work for GTM event tracking.
I’m basically trying to get a successful Contact Form widget submission to trigger an event on GTM.
I’ve tried using the following custom JS code that I found in an earlier thread:
widget.on("submit", () => {
dataLayer?.push({'event': 'form-submit'});
});
And I can see the event in debug (see screenshot below):
But, no matter how many times I try setting up a trigger with a custom event, it won’t trigger.
Some other things to note:
The site is unfortunately hosted on GoDaddy sites, so customisation is limited.
I have been able to successfully embed GTM code on the page that is visible in the debugger.
Any help would be appreciated.
2 Likes
following because I’m also working on GTM tracking and having issues with conversion events
2 Likes
Max
January 13, 2025, 12:19pm
4
Hi there, @SouthernYarra
Could you please send me a link to the page where your widget is installed? I’ll be happy to look into this for you
1 Like
Max
January 13, 2025, 12:27pm
5
Hi @JASON_SIMMONS
It’s impossible to track conversions in our widgets, but if you want to track the number of the delivered submissions, feel free to check this thread
1 Like
It’s impossible to track conversion in Google ads using GTM and the widget.on(‘submit’, () =>…
It seems that we should be able to add Custom JS code to track submits and tag those as conversions
2 Likes
Thank you - I just sent you a DM with the link to our staging site where the contact form is installed.
2 Likes
Max
January 14, 2025, 1:38pm
8
Thanks! I’ve passed your request on to the devs and will update you once I have their response
1 Like
Max
January 14, 2025, 1:40pm
9
@JASON_SIMMONS Yes, have you already tried the solution from the thread I’ve shared?
If it didn’t work, please send me a link to the page where your widget is installed
1 Like
Max
January 16, 2025, 12:16pm
11
Thank you for waiting @SouthernYarra !
To understand why the tracking doesn’t, we need temporary access to your GTM account - Providing access to your Google Tag Manager account - Elfsight Help Center .
Could you please share it with us? Once the access is provided, our devs will start investigating the issue
1 Like
Sure thing - an invitation has now been sent per the instructions.
Thank you.
2 Likes
Max
January 17, 2025, 10:20am
13
Thanks!
I’ve shared it with the devs and will update you once any news comes up
Max
January 20, 2025, 1:58pm
14
Thank you for waiting, @SouthernYarra !
Here are the reasons why the code doesn’t work with your widget:
1. The custom event has a filter that only triggers on pages with a /
in the URL, but your widget is installed on the /test-form
page… To fix it, you should remove this filter:
2. You haven’t set up a tag for this trigger:
This means no action will happen when the event is triggered. To make it work, select “Google Analytics” as the tag type and choose “Send an event to GA4.”
After that, you should choose your Custom Event as a Firing Trigger:
Please try to make these adjustments and let me know if it helped
1 Like