Google Tag Manager - GTM Data layer problems - google-tag-manager

I've installed the GTM code on a HTML5 bootstrap 5 template, the GTM container and a analytics global site tag added to GTM appear to load and initialise the DOM fine within the GTM preview/debug. The analytics tag pushes click data and the limited event data to the analytics console without issue.
The problem is with GTM variables. In debug mode the loaded GTM container picks up scroll and page events and sets the associated variables but in the case of form data layer variables it has set them once while in debug/preview mode during a newsletter form submission, but doesn't seem to want to set them again in different later debug sessions.
The template in use is:
https://www.okler.net/previews/porto/9.1.0/demo-digital-agency-2-dark.html
The developer doesn't want to offer support for GTM or GA so I was wondering if anyone could see an issue with why the newsletter signup at the end of the page for example that wouldn't set the form data layer variables as expected within GTM when filled and submitted.
Cheers

So you're saying that it pushes the dataLayer event only once per form submission and not more?
Is there a value of tracking multiple form submissions for one user?
If there is enough value to bother fixing it, you can just consider either finding how they prevent subsequent form tracking and fix it, or you can just have custom tracking in GTM. So that you would be able to detect CTA clicks.
But tracking CTA clicks instead of actual form submissions will lead to the opposite problem: too many CTA clicks.
Basically, you have to understand why you're tracking it. What question is to be answered here. In this case the obvious question is whether a user converted. To answer this question, you actually don't need subsequent submissions tracking.
If the question here is how many times the user submitted the form, then simple CTA tracking plus error tracking will suffice. It's not connected to form submissions tracking tho. Different questions - different answers.

Related

Single Page Applications and Google Tag Manager

I have a client who wants a tag to fire on a thank you page but have users come from a form fill on a previous page. I've tried all types of set ups but none of them work 100 percent. The only thing I know is that the client site is a single page application which does not support the refer variable. The option that semi-worked leverages the history change trigger type however the client needs to track people who uniquely submitted the form fill page and made it to the thank you page.
The best option here would be adding a dataLayer.push to the successful form submission callback. That is, if the form is submitted via JS.
If it's just a standard (legacy) html form submission, then GTM has listeners for those. But they're rare, especially on SPAs.
If adding a dataLayer.push seems too complex, well then use the thank you page (with the history change) in conjunction with a short-lived cookie to prevent double firing, but it's a hack and not without bugs.

Google Analytics configured with GTM showing two pageviews. But when I check GTM assistant it only shows one

I have configured Google Analytics using GTM in my single-page application build in next.js. In order to check the pageviews I push a custom event to the data layer called "pageview" each time a user change to a new page.
In GTM I have created a trigger that looks for the "pageview" custom event and fires up the google-analytics tag.
Everything seems to be working properly but when I enter the debugview of google analytics and I change from one page to another 2 paweviews are recorded instead of one.
I have check GTM assistant and the tag is not firing twice, so I do not know where the problem might be.
This is messing my stats as I have twice more pageviews than in reality.
Here in the photos i upload you can see the tag. In the history and message no tags are getting fired
While this is what happens in google analytics (both page_views contain the exact same parameters (same page_refererr, page_location...):
Here is the implementation insine next.js. Basically I call the function GTMPageView() each time a route is change. GTMPageView() is the function that pushes "pageview" into the datalayer
I really appreciate any kind of help as I have been hours trying to solve the problem and I cant get to the end of it.

How can I see the results of tags being fired from GTM to GA?

I will start with describing what I am trying to achieve, in order to avoid x-y problem. And if the solution I try to apply is not the best one, please, tell me a different one.
I have a website. There is an audio player on it. I would like to track in my GA how many users started the audio, how many users listened 25% of it, how many users listened 50% of it and so on. I can access the needed information (e.g. user reached 25%, so it is time to tell about this to GA through GTM) in client-side JavaScript, the question is only about setting up the GTM and GA correctly.
So, now that I described my intentions, let me show what I was able to do so far.
1 I created a custom metric with Hit scope in GA.
2 I created a tag which increments the metric created in the 1.
3 I created a custom event in GTM. When user starts playing the audio I fire the event with the help of dataLayer. And the event fires the tag which I created in 2.
4 I created a custom dashboard in GA to track how many users started the sound.
And now I am stuck. I get the needed data from my website to GTM. I trigger the tag which should send the data over to GA. I have the needed metric and dashboard set up in GA. And now I would expect the widget in my custom dashboard in GA to show that the audio was started, but it does not happen.
I am very new to GA and GTM and may not understand some concepts, as a result I may miss some necessary for troubleshooting information. I will gladly provide it if you need it.
Thank you (y).

Preventing an iframe on the same domain from triggering a page exit in Google Analytics

I am working on a third party website that contains a web application embedded in an iframe on the home page. This iframe is hosted on the same same sub/domain.
Currently page views are being tracked with _trackPageview. Due to a requirement by marketing both pages use the same Google account Id.
Since the iFrame was implemented the marketing department has noticed that the bounce rate has dropped to almost nothing. I suspect that this is because Google is interpreting the pageView event on the iframe as the visitor hitting another page on the website.
Just for additional information, the domain of the _gaq object is being set to "none" for both the container page and iframe.
Does Google provide a mechanism by which you can trigger PageView in such a way that it isn't interpreted as subsequent pageview in this scenario? (I know that trackEvent has a noninteraction property to deal with this?)
Am I better off just disabling the PageView for the default iframe page?
Does Google provide a mechanism - apparently yes, but probably not for your use case.
The field documentation for Universal Analytics describes the non-interaction field thusly:
Specifies that a hit be considered non-interactive.
So in UA this does no seem limited to events but to apply to all hits (which would include pageviews). I want to point out that I have no tested it and that it seems counterintutive, so it might simply be that the documentation is incomplete/wrong here.
However as you are using "classical" Analytics this does not apply to you. Since upgrading the code is a good idea in any case you might want to push for an update to Universal Analytics (this piqued my curiosity so I will test this over the next few days and update this answer with the results - maybe you want to wait until then, or simply test it yourself).
It's possible, but not 100% clear to me that disabling the PageView event on the iframe will prevent your users from registering a page exit (the pageview may get recorded regardless). You can try removing that event and see if it works.
But a better way may be to implement a custom filter on a new View excluding traffic to that specific class of iframes. Make sure you keep your old View (or create a new one with further filters) to make sure you're capturing those iframe views, if you think that's necessary.

Google Analytics scope question

I'm studying GA and and want to know if it is possible to save any custom information. For example I have a lot of checkboxes on the page and want to know checked statistics. I mean checks count for each checkbox separately. I see it in the following way: before postback I'm getting all checks information and send it to GA :).
What do you think?
You can use the Google Analytics javascript API to send this information to google, possibly as an event. This can happen whenever you choose, such as before form submission.
You can make events to each of the checkboxes, individualize them if you want, and see the results in "event tracking" in contents.
More info about event tracking from
google analytics docs

Resources