Event tracking with Google Tag Manager - google-analytics

Is the following setup of Google Tag Manager and Analytics correct regarding the variable use, naming etc.
Tag: GA tracking code
Tag: Goals w. macro below
Macro: (As specified in post) Event Action > eventAction; Event Category > eventCategory; Event Label > eventLabel etc.
Rules: GA Event > GAevent
Triggered by JS: dataLayer.push({ 'event':'GAevent', 'eventCategory':'Forms', 'eventAction':'Send', 'eventLabel':'Request' })
In Google Analytics:
1st Goal: Category > Forms; Action > Send; Label > Request Form
2nd Goal: Category > Forms; Action > Send; Label > Contact Form

Have you created a tag for Google Analytics Event?
You'll have to map the event category to eventCategory, etc. And then set the rule to GA Event equal to GAevent.(see attached)

Related

How do I view the values in Track_URL defined by Google Javascript events

This is the following event I am capturing in Google Analytics.
How do I view the event_label in Report or Explore options. What is the dimension that I need to select?
When I was viewing custom report/explore I simply done see any event category
gtag('event', 'Track_URL', {
'event_category': 'URL Tracking',
'event_label': window.location.href
});
Cannot find event_category dimension

Is there a better tutorial for creating a custom dimension for Client ID in Google Analytics with Google Tag Manager than this?

This is my first custom dimension and when I try to use it in my Analytics custom report it says: There is no data for this view.
I created a custom dimension in GA property which gave me 1 as index
I created 2 variables in Google Tag Manager:
{{Analytics Settings}} variable with UA tracking number and I set custom dimension index to 1 and value to: Client ID
{{Set Client ID in Dimension 1}} variable with custom JavaScript
function() {
var customDimensionIndex = 1;
return function(model) {
model.set('dimension' + customDimensionIndex, model.get('clientId'));
}
}
Then I created a Universal Analytics Tag with:
Track type: PageView
Google analytics settings: {{Analytics Settings}}
Override: ticked
Field Name: customTask
Value: {{Set Client ID in Dimension 1}}
Triggering: All Pages
Then I also set up a trigger for the container: Page View
Am I missing a setting somewhere?
Use customTask to get the ClientID from tracker object.
https://www.simoahava.com/analytics/improve-data-collection-with-four-custom-dimensions

Product view count tracking with Google Tag Manager and Google Analytics

In a symfony e-commerce project, to create a product view frequency report such that view count is increased when the user navigate to /product/detail/{id}. I am using Google Tag Manager and Analytics using the following as reference:
https://support.usabilla.com/hc/en-us/articles/360015738812-Integration-with-Google-Analytics-using-GTM-Data-Layer#
Google Tag Manager Setting
1. Create trigger
Trigger Type: Page View
Trigger Fire On: Some Page Views (Page path : contains : /products/detail)
2. Create variables
Name: dlv - productName
Variable Type: Data Layer Variable
Name: product.productName
Create Tag
Tag Type: Google Analytics: Universal Analytics
Track Type: Event
Category: Product Detail // static text
Action: View {{dlv - productName }}
Label: {{ dlv - productName }}
Value: {{ dlv - productName }}
Google Analytics Settings: {{ Google_Analytics_Track_ID_Settings }}
Tiggering: {{ Trigger_created_in_step_1 }}
Product Page
<script>
dataLayer.push({
'product': {
'productId': {{ Product.id }},
'productName': '{{ Product.name }}'
}
});
</script>
I can see dataLayer array is being sent to Google Tag Manager in the debug window. In Google Analytics > Behavior > Events > Top Events, I can see Product Detail in Event Category column. When I click the link the Event Action only shows View and Event Label is (not set). I want to create a tabular report like Product Detail: View Orange: 3, Product detail: View Apple: 4.
Cross-check that your {{ dlv - productName }} variable is properly populated and the value is available to the tag at the moment tag fires. If its value is populated later then the tag fires your event action would be tracked as (not set). If this is the case consider changing your trigger type to Window loaded or other event so the tag would grab the proper value from DL.
Although the key concept is provided in earlier answer, there are other solutions as well, which might give you better results.
So basically, you need to ensure, that the data you want to use from the dataLayer is available, when your tag is launched.
To achieve this, you can delay the tag to Window Loaded event, but you should be aware, that based on the size and content type of your page, a given percentage of your users will not have Window Loaded trigger launched, so you could miss part of your data. (They close the browser, navigate to other page before Window Loaded is reached.)
So an other option is to have the data pushed into the dataLayer before GTM is initialized. So your code looked something like this, placed above main GTM code in <head>:
<script>
var dataLayer = window.dataLayer || []; //define dataLayer, while avoiding overwriting its content
dataLayer.push({
'product': {
'productId': {{ Product.id }},
'productName': '{{ Product.name }}'
}
});
</script>
This way, your page view event will already see this data.
An other option would be to leave your code at it's current place, but to specify a triggering event, to let GTM know about the new data:
<script>
dataLayer.push({
'event': 'productDataReady',
'product': {
'productId': {{ Product.id }},
'productName': '{{ Product.name }}'
}
});
</script>
This way, you need to modify the trigger of your tag to be a Custom Event, matching the string used in the event variable. In this case, the data is available at this specific event.
Also, please note, that {{ dlv - productName }} should probably not used as event value, as Google Analytics accepts only integer values, while product name is likely to be a string.
An other consideration, is that you haven't specified (or at least haven't included it in your post), that the event should be non-interaction. If you generate an interactive event with your page load, assuming you also fire a pageview hit, you'll get an extremely low bounce rate.

Viewing gtag Custom Events Data in Reports

I have setup the new gtag custom event tracking code and it appears to be creating events as I see the previous category, action, and labels appearing under Events > Top Events. HOWEVER I can't figure out where I can view my "custom" parameters I have specified. For example, I am also recording "link_Text" and "time_taken" parameters on events.
gtag('event', category, {
"event_category": category,
"event_action": action,
"event_label": label,
"link_Text" : linkText,
"time_Taken": time_taken,
});

Enhanced E-commerce Checkout Behavior Report

I'm using Google Tag Manager tag to push checkout data to Universal Analytics.
Tag
Tag Type: Universal Analytics
Track Type: Event
Category: Ecommerce
Action: Checkout
Enhanced E-commerce: true
Data Layer: true
Fire On: Checkout
Trigger
Name: Checkout
Event: Custom Event
Fire On: checkout
JavaScript
dataLayer.push({
'event': 'checkout',
'ecommerce': {
'checkout': {
'actionField': { 'step': step, 'option': option }
}
}
});
Chrome Tag Assistant extension reports show that all values are passed to Universal Analytics collect action.
In Behavior > Events > Top Events I can see that events were properly registered by UA:
Unfortunately Conversions > E-commerce > Shopping Analysis > Checkout Behavior doesn't show any data... my question is: "Why ?"
It looks like you are not passing product data in your dataLayer push
https://developers.google.com/tag-manager/enhanced-ecommerce#checkoutstep (edited)

Resources