GA not displaying pageView dataLayer event - google-analytics

For some reason Google Analytics only shows the current active page on refresh. Not if I click through the site without refreshing.
If I inspect my website using Google Tagmanager preview I can see the dataLayer push, however it is not visible in Google Analytics..
image from dataLayer
image from GA tag added to GTM
Anyone know what the problem could be?

In you tag you are using the trigger 'all pages',this obey to the dataLayer {'event':'gtm.js'} while i see that you are pushing {'event' : 'Page View'}. If you see the debugger in both case you will see the Pageview as out put, but on the back, they are 2 differents things
The solution is to create a new trigger that obey to the event 'Page View' and use both triggers.
Greetings

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.

Google Optimize is implemented using GTM but is being triggered multiples times

We have an issue. GO is being fired every time I go to a new page. The website was built in SPA/react
Datalayer
They use a datalayer virtualpath that activates every time user go to a new page.
GTM
This DL was used as a custom event trigger to fire the Google analytics universal tag
Google optimize is associated to the Google analytics tag so every time a user to to a new page then go to a new page, the updatevirtualpath trigger is activated and the GO tag is fired.
Have anyone implemented Google optimize in GTM for react/ single page application websites where they use custom event as trigger ? When I use all pages trigger it works fine but when i use custom events it gets triggers every time user visit new pages..
Anyone know what can we do?

Custom Event Not Firing in Google Tag Manager

I am trying to fire a custom event in Google Tag Manager for a Virtual Page View. I want to be able to track a conversion in a dynamic shopping cart page where the actual URL does not change.
I added the following code for a dataLayer and set it up to fire when the event= VirtualPageView but it's not working.
Any ideas?
dataLayer.push({
'event':'VirtualPageView',
'virtualPageURL':'/thankyou',
'virtualPageTitle':'Thank You'
'conversionValue':'value'
'currencyCode':'currency'
});
Google Tag Setup
Custom Event Setup
Looking at your code I see a lot of missing commas after everything but the second line. This will cause the JS to fail which means no event is pushed into the dataLayer which means GTM won't see anything happening and therefore not fire any tags.
I.e. add a comma after 'virtualPageTitle':'Thank You and after 'conversionValue':'value'. Keep in mind that if you actually pass 'value' as a string and an AdWords Conversion Tag looks for a float, it will fail that tag.
GTM is fairly finicky and will just stop execution when JS code related to it fails.

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.

onclick events with Google Tag Manager and Universal Analytics

My client is using Google Tag Manager and Universal Analytics, and would like to be able to track the views for the videos on their website. Their videos are YouTube videos that are displayed in a shadowbox/lightbox via an onclick event.
I added a second onclick event to the same div that opens the shadlowbox, but the datalayer.push events are not appearing in the Analytics reports. I've included my onclick script below:
<div onclick="OpenVideo( 'S6cPlRkiKTw', 'youtube' );dataLayer.push({'eventCategory' : 'videos', 'eventAction' : 'click', 'eventLabel' : ’The Title of the Video', 'event' : 'shadowboxVideo'});”>
The "OpenVideo" function opens the video in the shadowbox and this is working fine, but the clicks are not being tracked in the Analytics reports.
Does anyone see anything wrong with my script or have any other suggestions? Because the client wants to see the title of the video in the reports, I can't think of any other way to do this other than using onclick events, but maybe I'm missing something.
Pushing variables to the datalayer does not by itself send any data to Google Analytics. You need a Google Analytics tag with the type of "Event Tracking" in the tag manager and "event equals shadowboxVideo" as firing rule.
Are there a lot of videos? You could potentially just listen for the element url and then create a rule in UA which replaces a Youtube URL with the title. I have it set up for a client where they just want to know the URL.
Also why not use autoevents in GTM instead of hardcoding?

Resources