I have a one page form with next step and back buttons that are to fire a virtual page view via jQuery. I am trying to capture these button clicks as Virtual Page Views in GTM using Universal Analytics but I am having a problem. I looked in in Real-Time in GA and it is only registering the browser url.
GTM UA Tag Setup:
I set my UA Tag up and I've set the tracking ID and set the document path to the data layer variable 'vpv' (see custom html below) and it fires when the {{event}} equals SendVirtualPageView. The Macro vpv is set up with the Macro Type as Data Layer Variable
Here is the UA Tag Setup:
http://bit.ly/QNdxKo (Note: I cannot post images yet)
The Firing Rule:
Here is my Custon HTML Tag:
<script>
/*Next Step 1*/
$(".StandardButton:eq(0)").on("mousedown", function(){
dataLayer.push({
'event': 'SendVirtualPageView',
'vpv': '/virtual/location'
});
});
/*Back Button 1*/
$(".BackButton:eq(0)").on("mousedown", function(){
dataLayer.push({
'event':'SendVirtualPageView',
'vpv':'/virtual/areaofinterest'
});
});
/*Next Step 2*/
$(".StandardButton:eq(1)").on("mousedown", function(){
dataLayer.push({
'event':'SendVirtualPageView',
'vpv':'/virtual/education'
});
});
/*Back Button 2*/
$(".BackButton:eq(1)").on("mousedown", function(){
dataLayer.push({
'event':'SendVirtualPageView',
'vpv':'/virtual/location'
});
});
/*Next Step 3*/
$(".StandardButton:eq(2)").on("mousedown", function(){
dataLayer.push({
'event':'SendVirtualPageView',
'vpv':'/virtual/contactinformation'
});
});
/*Back Button 3*/
$(".BackButton:eq(2)").on("mousedown", function(){
dataLayer.push({
'event':'SendVirtualPageView',
'vpv':'/virtual/education'
});
});
</script>
I did test in preview mode and I do see the event firing:
Fired on Event "SendVirtualPageView" (6)
Any insight would be greatly appreciated. Thank you in advance.
Found the problem, it's your vpv dataLayer macro:
The Data Layer Variable Name needs to be vpv
, not SendVirtualPageview
.