Dimension only tracks one Customer - google-analytics

I'm stumped. We only get one fruit type showing up in analytics when there should be multiple showing up for pageview tracking per fruit type;
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{analyticsAccount}}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{analyticsAccount}}', {
'custom_map': {
'dimension1': 'fruitType',
'dimension2': 'userId',
}
});
gtag('set', 'fruitType', {{fruitType}});
gtag('set', 'userId', '{{userId}}');
</script>
<!-- end global site tag -->
For some reason, it's only showing one fruit type when looking at either custom or standard reports and we know our system is sending in many types of fruit.
Unfortunately I don't have a public page I can share.

Related

Setting setSiteSpeedSampleRate in gtag.js

I want to increase the Sample Rate for Page Timings from 1% to 10% in google analytics.
We are using Global site tag (gtag.js) for adding GA to our site.
Following is current config:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123456-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-123456-1');
</script>
As per the doc, the following will capture the user load time, but it won't increase the sampling rate.
// Feature detects Navigation Timing API support.
if (window.performance) {
// Gets the number of milliseconds since page load
// (and rounds the result since the value must be an integer).
var timeSincePageLoad = Math.round(performance.now());
// Sends the timing event to Google Analytics.
gtag('event', 'timing_complete', {
'name': 'load',
'value': timeSincePageLoad,
'event_category': 'JS Dependencies'
});
}
This was solved by setting, gtag('config', 'UA-XXXX-X',{'site_speed_sample_rate': 100})

How to implement the Google Analytics event monitoring on a website if the standard Analytics tracking code seems not to be enough?

The website www.3dz.it is using with WordPress.
There are four languages and each one on a different domain (Italian .it, France .fr, etc.). It is in this way using WPML with the multi-domain option, since April 2018.
Up to April 2018, the events monitoring was going. For three months with the four domains, we were without data; in July we add the new analytics code so each language has an own Analytics property.
But we are still without the monitoring of the events.
Google analytics tracking code is since July 2018 set how is actually online.
<?php if(ICL_LANGUAGE_CODE=='en'){?>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-77106642-4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-77106642-4');
</script>
<?php } elseif(ICL_LANGUAGE_CODE=='it'){?>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-77106642-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-77106642-1');
</script>
<?php } elseif(ICL_LANGUAGE_CODE=='es'){?>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-77106642-3"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-77106642-3');
</script>
<?php } elseif(ICL_LANGUAGE_CODE=='fr'){?>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-77106642-5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-77106642-5');
</script>
<?php } ?>
Someone can tell me please how to implement the code to obtain the monitoring of the events again?
Maybe you could try to add the tracking codes on the website using Google Tag Manager? It's very easy to add multiple tracking codes into your Google Tag Manager account and only place one GTM-code to your website.
The developer notes are pretty straightforward with regarding adding event tracking to the page, for the gtag version of GA. However, I would also agree that managing your GA set-up and event tracking via Google Tag Manager would be more appropriate and scalable for your situation.
The problem was the different library of Analytics. I solved it calling google assistance. I changed the event script in the website and I modified the conversion in Analytics (event categories and actions)

Check event parameters on Google Analytics dashboard

I have recently started working on Google Analytics. I have added the following script just after the head tag
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXX-X');
</script>
Now i am inserting another script to create an event. After doing this , when i visit Google Analytics dashboard and go to REAL-TIME->Events->bottom most table , i can find the 'Event Category' with value 'engagement' and 'Event Label' as 'generate_lead' but how do i see other parameters that I am passing like 'value','currency' and 'transaction_id'. I want to check these parameters as well but i can't find it anywhere . Also can i map my own key-value pairs with the event by adding my custom parameters just like 'value','currency' and 'transaction_id' (which are already defined parameters associated with 'generate_lead' action) ?
gtag('event', 'generate_lead', {
'value': '2',
'currency': 'USD',
'transaction_id': '1234'});

Cross Domain Tracking with Global Site Tag - What goes where?

Having some issues with the implementation of cross domain tracking with the Gtag.js. I'm trying to do CDT for a restaurant website which has an external booking system with a 5 different URLs (1 for each restaurant booking system). I'm using the same GA property, but have failed to figure out if the Gtag.js is set up correctly. Here's what I have on the restaurant business domain:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-
1">
</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXX-1', {
'linker': {
'domains' [
'https://restaurant.bookingpage1.com',
'https://restaurant.bookingpage2.com',
'https://restaurant.bookingpage3.com',
'https://restaurant.bookingpage4.com',
'https://restaurant.bookingpage5.com']
}
});
</script>
Then, on the restaurant.bookingpage1-5, I should implement:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-
XXXXXXX-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXX-1', {
'linker': {
'accept_incoming': true
}
});
</script>
Afterwards, I implemented the restaurant main domain as a referral exclusion in Analytics.
Can anyone see if this is correctly set up?
You missed the colon after domains
gtag('config', 'UA-XXXXXXX-1', {
'linker': {
'domains' [

Global Site Tag Migration - Sample rate not working for pageviews

I've migrated from Universal to Global Site Tag. I've got sample_rate:50. It's not working for Pageviews.
Now: pageviews = 100. Expected: pageviews = 50.
Can you please show me an example that works?
https://jsfiddle.net/5owj671h/
<script async src="https://www.googletagmanager.com/gtag/js?id=<?
=$gaTrackingCode?>"></script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('config', '<?= $gaTrackingCode ?>', {
'custom_map': {'dimension3': hasAdBlock},
'sample_rate': 50
});
gtag('event', 'page_view', { 'send_to': '<?= $gaTrackingCode ?>',
'sample_rate': 50 });
</script>
The gtag scripts sends the pageviews automatically so when I stopped sending pageviews, it worked.
sampleRate works with users, not page views. And I guess sample_rate is a wrong name.

Resources