Firing a trigger group multiple times on a page - google-analytics

I need some help with Google Tag Manager and Google Analytics.
I want to send a pageview to Google Analytics if a user is viewing an image in a gallery on an article. The user is staying on the same URL, when he is viewing an image.
I created a trigger group which consists of two events
• Consent given by the user to use Google Analytics
• Event which is fired when an image in a gallery is being viewed
This works so far so good. Unfortunately, the trigger group is only being fired once on a page. When a user open the gallery and views the image and scrolls to next image, he is staying on the same URL. In that case, the trigger group is only being fired once.
How can I achieve that the trigger group is being fired multiple times on the same page without removing the second trigger (consent)?
I found out that I can create a second trigger group and add two image views and the consent as a trigger. But this solution means that I have to create 100 new tags, which is kind of crazy. Is there any workaround?
Thanks in advance

Once consent has been given by the user in a way that each pageview can pick up (e.g. you're setting it in some persisted state: data layer, cookie, etc.), you're ultimately just looking at triggering when the event happens.
Since you describe a scenario where it happens only once, I'd urge you to take a look at the other triggers on your tag and remove the page-specific trigger your description suggests you have in place. Replace it with only your event and consent triggers and it should work every time an event is observed.

Related

GTM UA Tag - Track Page Views using All Clicks OR All Pages as triggers

I'm still learning GTM, so please forgive me if this is a basic question. I've been researching but can't find anyone with a similar issue.
What I want is simple: to set up GTM to track page views in UA. (Easy enough.) But I looked at the setup of my predecessor, and he had the UA tag set up like this:
Tag Type: Google Analytics (UA)
Track Type: Page View
(GA ID)
Triggering:
All Clicks (All Elements)
OR
All Pages (Page View)
I'm trying to understand why they set it up with the All Clicks trigger. What I fear is that this is recording a page view every time a click is recorded, but I can't imagine my predecessor would have created a strange setup like that. I'd just as soon eliminate the All Clicks trigger, but I don't want to harm any of our future data without fully understanding. Bottom line question: is there any good reason for this tag to be set up this way, or is it wrongly inflating my numbers? Thanks in advance for any help.
It's kind of weird.
If the tag is for tracking pageView. The trigger should only be all page.
Still there might be 1% that your predecessor really knows what he or she is doing.
Maybe you can share the website and we can check if it is abnormal or not.
Update about the click trigger
The website is firing "Pageview" when click the link.
You can change the GA tag from pageview to event and set up like this
Category : click
Action : link_click
Label : {{the click Url}}
Then you can see which user is doing pageview and who clicks the link.

Tracking purchase after user returns from external payment

I have a hybrid app where the store is built on Webview the rest is native mobile. Users access the store via the menu button.
Since the store is web, I set up dataLayer variables where I have user information such as nickname, id, etc and also an ecommerce object where the items in the store are shown. I have also added dataLayer events such as view_item, process_purchase and purchase_completed.
I have integrated GA4 and GTM and I pass all dataLayer variables as event parameters so I can have organized.
The main problem is that, when users pay their order via card, they are taken outside the website to the payment provider solution, and then once the payment is finished, they return to the payment confirmation page where I set up the "purchase_completed" dataLayer event. This appears to break the tracking of the funnel, so sometimes purchase_completed event does not fire, or sometimes it fires but empty (no data on datalayer).
Is there a way I can fix this issue?
To me, your problem sounds rather shop related, than GTM related.
If your DataLayer.push event is malfunctioning (either empty or not firing at all), you need to your code.
GTM does not care for a funnel, if the dataLayer event fires and both trigger as well as tag are setup corretly, the tag is executed.

Google Tag Manager and Single Page apps

I'm trying to integrate Google Tag Manager with my Ember app. I'm having a hard time understanding how to notify GTM that the page changed, and send a page view event.
I've read a lot of things online, mostly working around creating a new variable for a "virtual page" or something, but obviously this is far from ideal.
I'd like to be able to just use dataLayer.push to notify the page actually changed. Is there an easy way out I didn't find or is it really a pain to track with GTM on SPA?
This was asked quite a while ago. With the current feature set of GTM, you can easily set up SPA page tracking without much trouble.
First, go to Triggers and create a new trigger. Select History Change as the trigger type. This will create a trigger that fires every time the location history changes.
Then create a new Tag of Universal Analytics type and set it up as per the screenshot below.
[
As for the trigger, set the previously defined History Change trigger, and you're done. Every time a navigation occurs in your SPA, a page view event with the proper page path will be triggered.
EDIT: as trognaders pointed out in a comment, this does not track the initial page view. To remedy, simply add an additional trigger for your tag that fires on the Page View event (All Pages). See screenshot below.
You definitely need to push events into the dataLayer which you can then trigger a GA page view tag in GTM. So to push an event into the DL:
dataLayer.push({'event':'virtualPageView'});
Then setup a trigger called 'vpv' which fires on a custom event called 'virtualPageView'. Add that trigger to a GA tag.
The best thing to do is also send through the details of the virtual page when you send the event. This way you can set up variables that pull these dataLayer property values into the page view call. So you might do this:
dataLayer.push({
'event':'virtualPageView',
'page':{
'title':'contact us',
'url':'/contact'
}
});
So you'd setup a variable called 'DL- page title' (for example) which is a dataLayer value of 'page.title' and another variable called 'DL - page url' which is a dataLayer value of 'page.url'.
You then setup a new Universal Analytics tag which has all your usual pageview settings but with 2 'Fields to Set' (under More Settings). Set 'title' to {{DL-page title}} and 'page' to {{DL - page url}}
Finally set the trigger to 'vpv' and you'll find everytime you push the event + data into the datalayer you'll get a pageView fired off with your virtual page's title and virtual url.

Analytics User-ID view not tracking events

I've created a new view in Google Analytics with everything set up the same as a currently functioning one, only with the addition of User ID tracking turned ON. It's using the same property so the UA code has not changed.
I've copied over everything that I can think of from the current view to the new view. At first glance everything was working fine, page views were coming through via Real-Time correctly and matched up with the values seen in the current view.
For some reason though, the new view is not listing ANY actual events in Real-Time, however the events graph is being populated.
The current view IS tracking all the events correctly.
We use Tag Manager to handle all our events among other things, and using the debug mode, all events were also being triggered correctly. Finally, I've also used the GA Debugger chrome extension, which again is not showing any issues. The new User ID property is being passed through to analytics as I'd expect.
I've tried searching for any issues related to User ID views and tracking events, but came up blank, presumably because there is no inherent issue with this set up.
Any suggestions?
I found out that the reason that the events were not tracking is because the user id was not being sent along with every event.
I believed that once it was set on page load every analytics interaction after that would use that user id. This was not the case. In Tag manager I added a 'Field to set' property for all relevant tags like so;

Using Google Analytics, if I explicitly log an event using _trackPageview, does that count as a 'real' page view?

For example, if I have a news page that's already being tracked via GA and I add a javascript event to capture clicks on a specific link to the news page (e.g. navigation) am I then 'double counting'?
If a fake pageview is not beneficial in this situation, and from your description that you're looking to track an engagement click on your page, use Event Tracking instead of Pageviews.
Tracking a click/event is easy (especially if you're already using Javascript). The best part is that this event is not considered a page view, keeping those stats safe.
The implementation is simple and allows for quite a bit of customization:
_trackEvent(category, action, opt_label, opt_value)
Below is an example of a link that's been encoded with an event tag:
Play
Here's the Google Analytics resource page on Event Tagging:
http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html
Well it's not a real page view, but Google Analytics thinks that it is--i.e., it shows up in your pageview counts.
Fortunately, it's easy to filter those so they don't contaminate your pageview data.
So for instance,
_gaq.push(['_trackPageview', 'unique_virtual_pagename']);
So in your GA Browser, you'll see the number of clicks actually shown as the number of pageviews of *unique_virtual_pagename*, which is not good.
There are a two ways to fix this (that i am aware of): (i) set a temporary filter at the bottom of the pageview table; or (ii) set a persistent (c*ustom*) filter in your Admin Panel (which i think is best) to remove pageviews having only the name *unique_virtual_pagename*, or whatever name you've chosen. This will of course take up to 24 hours to set, so the best plan is to set the filter first, then add the javascript to your page. so the filter is active when you begin collecting clicks.
But that just solves the problem of disaggregating these virtual pageviews from your real pageviews, you still need a way to count/record them.
I prefer to create a separate profile in these cases. So first, i filter the virtual pageviews from my actual pageviews using a custom filter, then i create a new profile which has another filter excluding everything but these virtual pageviews. I usually give that profile a name based on the event.
What you're doing is registering what's called a 'virtual page view'. To GA it's seen as a real page view and shows up in your content report's and page view counts etc. This is often useful if you want to show a page view for media that GA can't track. It's also commonly used to count an event, such as a button click, as a goal conversion.
If you just want to record the event and not count a page view you should look at using GA event tracking instead.

Resources