Virtual Pageviews in Google Tag Manager - google-analytics

I am posting this question again with detailed description. Hope this time I will get valuable advice from Experts!!
I want to create Google Analytic funnel for Registration Page(On successful Registration, Url doesn't change). I have created a virtual pageview tag in GTM
and pushed following Datalayer on Success:
dataLayer.push({
'event':'VirtualPageview',
'virtualPageURL':'/virtual/login/',
'virtualPageTitle' : ' Registration Page'
});
Trigger
When I am debugging the getting message: Tags are not fired on this page but on the left side event is showing "Virtual pageview".
Can Anyone help/guide me?

I have checked your query and noticed that the event name in your trigger is wrong. Please change event name to "VirtualPageview" and it will work. You can read more about vpvs here: http://stackbug.com/google-analytics/how-can-you-generate-a-virtual-pageview-on-event/

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.

How to track site search(with query and without) via GTM? 2 ways of searching

I have a search bar on my website and there is 2 ways of getting search results
When they type keyword in the search bar and they press enter button. They will be redirected to the page with the url address with query. For example: /?s=test - I have this in GA but...
In the same time when user is typing keyword he gets search results in real-time via AJAX under search bar in the form of a list . When
the displayed result is clicked user will be redirected straight to the result page
https://imgur.com/L7aqOfM
And I want to know how to track this second option because Google Analytics is not able to collect this type of searching via AJAX.
Google Tag Manager and VirtualPageView? How to do it guys cuz Im a newbie
In your AJAX's success callback, you can fire a virtual pageview or an event with Google Analytics. Since you have used Google tag manager, you can push a dataLayer event
success: function(data) {
dataLayer.push({
'event': 'searchEvent',
'keyword': 'keyword'
})
.........
Then you can use this in GTM to create a trigger and fire an event or a virtual pageview. If you are using Virtual pageview, override your location parameter with something like /?s={{keyword}}, where {{keyword}} is a dataLayer variable and it would work

Google Tag Manager dataLayer variables are undefined

When my page is displayed, I push some data to Google Tag Manager (GTM) dataLayer:
dataLayer.push({
event: "MY_EXPERIMENT",
variant: "A",
result: "FORM_DISPLAYED"
});
When the form is submitted, I push some new data:
dataLayer.push({
event: "MY_EXPERIMENT",
variant: "A",
result: "FORM_SUBMITTED"
});
I've created dataLayer variables in GTM, and I've inserted those in the category/action/label fields of my tag in GTM. One of the variables is setup like this:
The tag is triggered by URL path, and in preview mode it works.
However, when I look the event up in the live dashboard of Google Analytics, only "undefined" is displayed in the category/label/event columns. It seems to me the variables are not set up correctly, but I've looked through everything and it seems just fine.
What am I doing wrong?
It's hard to tell without any screenshots or further details but what's most likely happening is that your tags are firing too early. You said that the GA event tag is triggered based on a URL path. This most likely means that you're using the All Pages trigger in GTM with an optional filter to only fire on specific pages. However, you're most likely only executing those dataLayer pushes after the GTM container code. This means that at the time of tag firing, those dataLayer pushes haven't executed yet and that's why you're getting undefined in the values of the variables.
To fix this you should change the trigger of your GA event tag from All Pages to a Custom Event. In your case, the custom event name would be MY_EXPERIMENT.
I figured this out. I hadn't checked the "Use Datalayer" checkbox under More settings -> E-commerce in my event tag in GTM. Hard to find the checkbox, and I haven't seen it documented in any tutorials. But that solved my problem!
Sorry for no screenshots.

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.

How do I track Virtual Pageviews in the new version of GTM?

I've attempted to use the new version of Google Tag Manager to track virtual pageviews and send those to Google Analytics, but they don't seem to be sending properly.
For my Trigger, I've used the builtin History Change event type and have placed that in a tag with my Google Analytics id. The tag is set to Page View track type.
In Google Analytics, I see a pageview, but it just says the user is on the root directory. Also, I'm working in Localhost.
Is there something I missed?
I'm not sure to get the complete description of your setup but maybe an other way of tracking your virtual pageview could be directly by adding data layers directly in your code.
dataLayer.push({
'event':'VirtualPageview',
'virtualPageURL':'/order/step1',
'virtualPageTitle' : 'Order Step 1 – Contact Information'
});
For the trigger, you will then be able to send the fire on of your virtual pageview as a event matches VirtualPageview.
Your Tag need to be set up as a pageview.
Also, using this article for GTM v1 : http://www.lunametrics.com/blog/2014/09/10/fire-virtual-pageview-google-tag-manager/, you can set up your {{virtualPageURL}}
In GTM V2, in your tag, you will have to use the - More settings / Field to set field Name = Page, Value = {{virtualPageURL}}.
Are we talking here about a one page iOS/Android App?

Resources