I am implementing the purchase tracking according to the google documentation.
I have a small problem with the purchase tag configuration.
If i create a tag with the provided configuration:
Tag type : Universal Analytics
Track type : Pageview
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
Trigger: event equals gtm.dom
it triggers on every page, which i don't want as it doubles my page views.
(page views are usually tracked via a AllPages-Pageview trigger).
I could add an event property to the object pushed to the dataLayer as it is done for the other ecommerce events (addToCart etc.) and an according trigger.
But as the documentation suggests a different way i assumed there is a reason and way to get the correct behavior using the provided documentation.
What am i missing and what is the correct trigger configuration?
First of all if you are adding Enhanced Ecommerce on website you can have 1 page view tag with "enhanced ecommerce" feature turned on (dataLayer = true) and that will handle your page views as well as Enhanced Ecommerce data. However if you want page views to be tracked as we do in usual way you can send Enhanced Ecommerce data in "Events".
So for example for EE impressions you can create an event;
Event Category = Enhanced Ecommerce
Event Action = Product Impressions
Event Label = {{Page Path}}
And enable Enhanced Ecommerce feature on -> dataLayer = True
And add trigger for this event.
Similarly for Purchase EE you can create another event
Event Category = Enhanced Ecommerce
Event Action = Purchase
Event Label = {{Page Path}}
And enable Enhanced Ecommerce feature on -> dataLayer = True
Add trigger =
Trigger Type = Dom
Page Path = /checkout/success (or what ever your final confirmation page is)
If your EE purchase dataLayer contains an event you can create event trigger as well.
Hope this helps.
Related
I'm implementing enhanced ecommerce through Google Tag Manager (GTM) using the dataLayer and I'm having issues with some values that are being reported double to the reports.
The value reported double is 'Product Checkouts' that can be seen in the 'Product List Performance' report in Google Analytics (GA).
I've spent a lot of time on this and I'm sure, I don't have one of the following common pitfalls:
There is absolutely only one GTM snippet in the code.
When the user refreshes the page the value isn't reported again (as after refreshing nothing is pushed to the dataLayer)
Triple checked for spelling mistakes
Pushed the values to the dataLayer before GTM snippet
In the image below I'm showing an example;
First, the add_to_cart is reported properly; only once.
While the checkout is reported twice every single time for every product (doesn't matter how many products reported)
This is the list of Tags in GTM:
1
Tag type : Universal Analytics
Track type : Pageview
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
Trigger: event equals gtm.dom
2
Tag type : Universal Analytics
Track type : Event
Event Category: Ecommerce
Event Action: Product Click
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
Trigger: event equals productClick
3
Tag type : Universal Analytics
Track type : Event
Event Category: Ecommerce
Event Action: Add to Cart
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
Trigger: event equals addToCart
4
Tag type : Universal Analytics
Track type : Event
Event Category: Ecommerce
Event Action: Remove from Cart
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
Trigger: event equals removeFromCart
5
Tag type : Universal Analytics
Track type : Event
Event Category: Ecommerce
Event Action: Checkout
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
Trigger: event equals checkout
6
Tag type : Universal Analytics
Track type : Pageview
Enable Enhanced Ecommerce Features: no
Trigger: All Pages
I see an issue with the configuration of your tags. You have first tag as;
1
Tag type : Universal Analytics
Track type : Pageview
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
Trigger: event equals gtm.dom
This above tag is going to fire on all pages (including the final confirmation page). While you have another tag that you have configured to fire on final confirmation page that is.
5
Tag type : Universal Analytics
Track type : Event
Event Category: Ecommerce
Event Action: Checkout
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
Trigger: event equals checkout
So actually the tag 1 is duplicating "all" the data including the transaction one, transaction one is more visible as you are checking this. For debugging purpose you can turn off the 1st tag, and than test you should be able to see single transaction instead of duplicate.
This is a pitfall of the official docs, using pageview to send ecommerce data will indeed duplicated the pageviews and interact with which events is sent when. To avoid this, better use only custom events as trigger and code when they fire.
This could be because of anther event that fires using a tag with enhanced ecommerce settings on
On a site with a searchable directory of members, is there a way to track how many users are clicking on each member profile, and how many users click on the contact button within each profile (i.e. rather than just general clicks, can you track specific profile clicks with google analytics)?
The best way to do this would be as follows:
Define a hit scoped dimension called "Member ID" (assume index 1)
Define a hit scoped metric called "Profile Clicks" (assume index 1) with type Integer
Define a hit scoped metric called "Profile Contacts" (assume index 2) with type Integer
Whenever a user clicks on a member profile, send a Google Analytics event as follows:
Event Category = Profile
Event Action = Click
Custom Dimension 1 = <member_id> e.g. 123
Custom Metric 1 = 1
Whenever a user clicks on the contact button within the profile page, send a Google Analytics event as follows:
Event Category = Profile
Event Action = Contact
Custom Dimension 1 = <member_id> e.g. 123
Custom Metric 2 = 1
To send a Google Analytics event with custom dimensions and metrics (assuming you are not using Google Tag Manager), you would execute this code:
ga('set', 'dimension1', '123');
ga('set', 'metric1', 1);
ga('send', 'event', 'Profile', 'Click');
More info on passing custom dimensions and metrics to GA can be found here.
If you're using Google Tag Manager, then you would need to push the values of the custom dimensions and metrics onto the GTM dataLayer and then configure a Google Analytics event tag to fire and pick up the values.
In my product page detail, i have a crosselling section which loads a product list when user scroll down. I can trigger a custom event when products in this section are loads (like productsDowloaded).
How can i send product impressions with google tag manager ?
Implement the data layer following these specifications to track product impressions. If you are sending the data asynchronously, push an event to the data layer (eg: event: 'crossSellReady') and fire your custom event GA tag with a rule based on event = crossSellReady. In the custom event tag, make sure to enable enhanced eCommerce tracking, and the tag should automatically pick up the product impression data contained in the data layer. Let me know if you encounter any issue.
When the page is first loaded the first batch of cross sell products are pushed to the dataLayer as impressions and a GA pageview is sent. The GA pageview is a simple GA tag that is fired after the page is loaded.
After that, when the cross sell products are loaded asynchronously, i.e. whenever the user scrolls down, only those products are pushed to the dataLayer and a custom dataLayer event is fired in the success handler of the ajax request. For example:
// Inside Ajax success handler...
dataLayer.push({
'event': 'Custom'
'eventCategory': 'ecommerce',
'eventAction': 'ajax-load'
'eventLabel': 'cross sell'
});
You create a separate generic GA tag that sends events and is fired when the Custom event is pushed to the dataLayer. Inside the generic GA event tag you set all the of the following macros which are of type dataLayer variable:
{{event category}} -> eventCategory
{{event action}} -> eventAction
{{event label}} -> eventLabel
You can also add a nonInteraction macro in the generic GA event tag as well. Your use case, in my opinion, is considered a user interaction (user scrolled down) so the nonInteraction macro should not be set.
If you are using product lists, be careful of the positions of the cross sell items. Whenever those products are asynchronously loaded, you should note down their positions so you can track their positions in the product list tab of the GA dashboard correctly.
P.S. The generic GA event tag has multiple benefits, you can find more information about what I'm saying by reading the relevant article in Simo Ahava's blog.
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?
I have a page loaded in via AJAX.
In Google Analytics I could have just called gaq.push('_trackPageView','/someurl') in my AJAX success function. However I can't seem to find a way to do this when implementing GA via Google Tag Manager.
The only alternative seems to be a "virtual page view" event, which isn't exactly what I'm after:
Does anyone know how to do this?
on the Ajax success, do:
dataLayer.push({
'event':'sendVirtualPageview',
'vpv':'/blah/blah'
});
The 'event' is just to send the virtual pageview to GTM. It's not a traditional, although it could be, Google Analytics event.
You should be able to folllow the rest of the tutorial to create your rule and setup the tag type.
Here's how you enable Virtual Page Views on your Google Analytics tag in GTM.
GTM v2:
Go to the Variables page. Enable the Event variable {{event}} by ticking the Event checkbox inside Utilities under the Enable Built-in Variables heading.
Create a variable named Virtual Url with type Data Layer Variable and set the Data Layer Variable Name to "virtualUrl".
Go to the Triggers page. Create a trigger named Virtual Page View with type Custom Event and set the Event name to "virtualPageView".
Create a tag GA Virtual Page Views with product Google Analytics Universal. Set your Tracking ID UA-xxxxxx-xx. Set the track type to Pageview.
Under More Settings > Fields to set, click + Add Field.
Set Field Name to page with value {{Virtual Url}}.
You can add additional fields here, such as title, UTM campaign etc. Add variables then add them here.
Click Continue. Under Fire On, click More. In the triggers popup, tick Virtual Page View. Click Save.
Click Create Tag.
GTM v1:
Create a macro {{Virtual Url]} referring to dataLayer variable "virtualUrl".
Create a {{Virtual Page View}} rule as {{event}} equals "virtualPageView".
You should already have an {{event}} macro, but if you don't, create one using the dataLayer variable "event".
Updates to your Google Analytics tag:
More Settings > Basic Config, tick "Virtual Page Path" and use macro {{Virtual URL}}.
Remove the {{All Pages}} firing rule.
Add the {{Virtual Page View}} firing rule.
GA Fields:
page = the path portion of a URI. eg. /blog/topic/post.html
title = used to specify the <title> contents
campaignMedium = used to specify the URI utm_medium
campaignSource = used to specify the URI utm_source
campaignTerm = used to specify the URI utm_term
campaignContent = used to specify the URI utm_content
campaignName = used to specify the URI utm_campaign
Usage:
In your web app, call it like so:
dataLayer.push({
'event': 'virtualPageView',
'virtualUrl': '/relative/page/path',
'virtualTitle': 'My page title'
});
You can rename any of the variables above - this is just an example based on how we do it.