Tracking page views when item is out of stock - google-analytics

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:

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}}

Events trigger after next click in Google Tag manager preview

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.

Event firing Multiple times in Tag Manager

I Have created an Event from the Tag Manager. When I check by clicking it works fine but the problem is, this event is firirng number of times I have clicked on it. Example if I click for 10 times Event is firing 10 times. I want only one click to be recorded as I don't need duplicates can anyone help me in this regards
For any type of tag, you can set this behavior within the Advanced Settings block of the tag setup screen:
If you choose 'Once per page' for the 'Tag firing options', the event will be fired multiple times, but this tags will run only once per page.

GTM: pageview not firing in product page section even when all pages trigger

I'm inspecting the tags implementation for a company.
1) I'm finding it strange that the PageView tag implemented with GTM fires in the home page, but not in the product page.
For example, in this laptop producto page:
https://www.lacuracao.pe/curacao/laptop-asus-x507ub-br161t-core-i5-156-1tb-4gb-x507ub-br161t?cm_cr=No+Campaign--Web+Activity--No+Name-_-Widget_CatalogEntryRecommendation_701_3074457345618283237-_-Laptop+Asus+X507UB-BR161T+15.6%22+Core+i5+7ma+Generaci%C3%B3n+1TB+4GB+NVIDIA+2GB-productImageLink
Even provided that this tag is supposed to fire on all pages.
2) Also I'm noticing that my clicks listeners are not working in this section also. But work in other sections of the page. May it be the gtm.click or the gtm.linkClick
3) The GTM container is instaled in the code, as this image shows:
What could be preventing the PageView Tag to fire and the click listeners to work?
My PageView TAG:
The All Pages trigger is the default one.
This is my container preview:
https://www.googletagmanager.com/start_preview/gtm?uiv2&id=GTM-5VMNG2H&gtm_auth=T6D4je8bCBlHxyaINtja3Q&gtm_preview=env-5&gtm_debug=x&url=https://www.lacuracao.pe/curacao/laptop-asus-x507ub-br161t-core-i5-156-1tb-4gb-x507ub-br161t?cm_cr=No+Campaign--Web+Activity--No+Name-_-Widget_CatalogEntryRecommendation_701_3074457345618283237-_-Laptop+Asus+X507UB-BR161T+15.6%22+Core+i5+7ma+Generaci%C3%B3n+1TB+4GB+NVIDIA+2GB-productImageLink
You may want to check how the dataLayer is being implemented. I ran into an issue where my Page View tag/All Pages trigger was broken because I had initialized the dataLayer after the gtm code snippet.

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