Events trigger after next click in Google Tag manager preview - google-tag-manager

My custom event does populate into my GA4 Analytics, but during testing, the events in the GTM preview don't show up until the next click after the triggering event.
Oddly, it seems that after the initial trigger of each event (with the followup click) they appear to
For the follow-up click, I can click anywhere on the page.
The trigger is set to "All Elements" and Firing when the element matches a CSS selector of [data-XXX="XXX"] and the page URL contains a keyword.
I'm concerned that due to the extra click needed I may be losing some non-zero portion of data. My site doesn't get too many of this particular event so every one counts. The event tracks our online reservation and I need it to be accurate in our Google Ads data so our ROI on ad spend is as accurate as possible.
I know there's a trigger on form submit, but the form doesn't actually trigger this way due to JS. And it does work with the "All Elements" trigger I'm just concerned about the extra click before I see it populate in the preview window.

After closer inspection I found that the followup click is not required.
The summary view does not appear to show ALL info for every single click in realtime. Instead if you choose to look into the data for each click as the happen you can see that the events are triggering as intended, but that new events don't always show in the summary view until after the next click registers.
Hopefully, a future GTM update may fix this as it is not intuitive that the summary view would ever not have the most current data.
TLDR: check the view for each click in the GMT preview and don't rely solely on the summary view.

Related

Just Links click event - firing triggers not working

screenshot of red crosses
I'm new to GTM and at the beginning of setting up my first click event using a UA tag and a variable containing my tracking ID. That part fires ok. I created a simple Just Links trigger set to All Link Clicks. But when I debug with preview, I get 'Link Click' ok in the left summary, but it says tags not fired - my GA tag and inside the Firing Triggers haven't worked. There's red crosses against All Pages and the gtm filters. I've triple checked all my settings against tutorials I've followed but have no idea when the Firing Triggers have not worked?
existing tag
existing trigger
new tag
preview firing
There is an error from your trigger.
Your current trigger is pageView in all page
So you need to create an trigger For Just Link
Step1 : Change type to Just Links
Step2 : Give an appropriate name for this trigger.
Step3 : Save and change your tag's trigger to this one.
I believe this will work !
Just remember :
Tag is what you are sending.
Trigger is when you are sending.
Add :
From the comment. I guess the problem is we need to create another tag for tracking Link Click.
Since you original tag is for tracking Page View. We need to have 2 tags for your scenario.
In the event tracking. There are 3 level :
Category > Action > Label
You can come up with your own structure on this.
The screenshot is just providing a general one.
Especially for the label, You can decide whether using {{click text}} or {{click url}}

Tracking page views when item is out of stock

I want to track page views of items that are out of stock using Google Tag Manager events.
My trigger in GTM is based on the visibility of an element on the page (the out of stock notice). My event and tag are set to fire once per page. These conditions appear to be working properly.
At present, if I navigate to a product that is in stock, then the tag does not fire. If I then navigate to an item that is out of stock, the tag fires.
However: After viewing an out of stock item, as I continue to browse other in-stock items on the website, the event seems to persist as I can see in Google Analytics that my page view count displaying this event continue to rise for items that are not in stock.
I must have something configured wrong or misunderstand how something works.
I looked for solutions like ending an event or resetting the status of an event to no avail. What else should I consider?
EDIT:
Here is how my tag looks:
And here is my trigger:

GTM - Only Click DataLayer elements are available whereas I need a Trigger on a Load Element

In GTM, I'm trying to trigger on page text that's visible after a form is submitted since it does not change to another URL or refresh the page i.e. #bxAddSuccessTitle. However, the summary of events in GTM only capture the Click elements from the DataLayer. I've tried DOM, Custom JS variables, Window Load/Page View triggers and nothing populates until I click on the page.
Is there a workaround where I can trigger on something that is visible in the page source, but not necessarily in the datalayer?
enter code hereConfirmation Page
enter code hereConfirmation Page Source Code
enter code hereGTM Summary of Events
Sounds like you need a visibility trigger, probably with the "observe DOM changes" option active.
This will fire when an element comes into the viewport either by scrolling, when it is unhidden via css or, with the "observe DOM changes", when the element is created/inserted dynamically after a user interaction.
A possible caveat is that the trigger will only fire when the element is visible to the user (unhiding or inserting below the fold will not activate the trigger).

Is there an option to track(goals) ajax form with checkbox that works screen by screen?

I have an ajax form with some questions of choice but every question will be displayed on new screen (screen by screen) by button.
I want to track users behavior on my form page. I want to know after which question user has left the page (which questions they filled up)
Also I would like to know from which devices they have visited the form page and how long they were on this page
Is it possible to track all of this by GA or GTM?
If the form is screen-by-screen as you said, it sounds like you need to track two things.
An event for clicking the "Next" button
A virtual pageview for each screen.
This way, you can look into your Exit Pages report to see what screen the left the page from.
As for device tracking information, that type of data is automatically captured by GA.
So, basically. You'd have a virtual pageview for the first screen (assuming this form is a popup modal). If it's not a popup modal, then you'd just have the normal pageview for that first screen.
For instance, if the user has to click a link/button for the form to start, then you'd, ideally, fire an event for clicking that link/button, fire a virtual pageview when the first screen loads, fire an event when the user clicks the next button, then rinse and repeat for the subsequent screens.
Also, it may be a good idea to track the last screen's "next" button (or "finish") button as a separate event. Then, you can see in your events report who has filled out all of the screens and submitted.
Another thing worth pointing out: If you also want to show which question was the last one filled out, you can provide the name of the question (or an id, or some kind of brief and canonical identifier) in the virtual pageview as a custom dimension.

How to set up a tag to record clicks of sort by categories list of a product page

I am very new to gtm and trying to set up a tag that can record clicks of the sort by categories of all product pages.
Each category page has the sort by (like any other website), it for example has the options:
Price high to low
Price low to high
Date added
Name a-z
Name z-a
What I am trying to do is to be able track how many people click on those individual sort by categories? I am not sure how to go about this, need guidance.
Thanks!
You need to identify the click as it happens and then send the information to GA. So you need this two blocks in GTM: an universal analytics tag as "event" and a trigger which listens for clicks.
If you don't know CSS selectors the most easy way to find the right values for the trigger is by try and error. Activate the GTM debug mode and navigate to your list.
Now click on the sorting feature, does a click appears in the GTM debug console (the one you see in the lower part of your page)? If no click appears you need to activate at least one trigger which simply listens for any clicks that happen on your page. Now when you see clicks in your GTM debug console: select the click (in "summary" tab of gtm debug console) which appeared when you sorted. Now when the click is selected in summary the "variables" tab will show you all values within your defined variables.
All click variables should be activated in GTM. Then you can see what information is hold in them, when the user sorts.
As you now know the values of your variables when the sort action appears, you should use this information to create a trigger (something like: click element contains "xyz") and an universal analytics event which will send event category, action and label (one of these should contain information on click element) to Google Analytics as soon as your trigger is activated.

Resources