Google Analytics gtag doesn't count - google-analytics

I am using gtag and event tracking. However, it doesn't count at all... I have no idea why it doesn't work even though I clicked the link. Always it shows 0. Please give me any advice. Thanks.
<script async src="https://www.googletagmanager.com/gtag/js?id=my id"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'my id');
</script>
test link

I am using the following construction:
Link
it works for me:
P.s. I didn't configure anything on GTM and GA.

Related

Unable to get the referrer information

I am very new in Google Analytics. I am stuck in very basic problem. Actually I have a page abc.com/ab.html . In this page there is a link of xyz.com/getref.html. on getref.html i have paste following tracking code.
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-FAKEID123"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-FAKEID123');
</script>
After clicking on the link on abc.com/ab.html it redirect me on xyz.com/getref.html . But I am not able to get the referrer information in Acquistion/All Trafic/Referrals section. It showing nothing in this section. Please Help me what could be the issue.

Google analytics error net::ERR_NAME_NOT_RESOLVED

i have problem with google analytics.
i have code in my website : https://www.poma.sk/ code is here : https://prnt.sc/saaix8
but i see error in console : https://prnt.sc/saah3d
what is wrong ? thanks
You have an ad blocker preventing the Google Tag Manager code from loading. In my case, I had to allow the domain in my Pi-hole admin settings.
The problem is this row:
<script async src="https://www.1a3c9a8ebcc58dac607cdcc47329d03d-gdprlock/gtag/js?id=UA-61560074-2"></script>
Should be as below::
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-61560074-2">
Michele .
Code which I add to site is :
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-61560074-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-61560074-2');
gtag ("config", "AW-804674955");
</script>
Why it change in site ?

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)

Global Site Tag (gtag) doesn't send anything

I've set up a new Analystics account, and copied over the tracking code. It's of the kind
<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>
I then track an event using
gtag('event', 'click', {
event_category: 'acquisition',
event_action: 'click',
event_label: 'download',
event_value: 1
});
I've tried all kinds of gtag() syntax, however nothing ever gets sent to Analytics. When checking the Network tab in Chrome debug tools, there is no communication with Google at all. (the dataLayer array is properly populated)
I don't want to use Google Tag Manager, just looking for a simple "track event via Javascript".
Looks like it is working, might be a local computer/browser addon that's blocking the call to GA

Injecting Google Analytics dynamically

I'm trying to inject Google Analytics on acceptance of cookies due to GDPR. I've embedded most of the GA code in a function enableGoogleAnalytics() as seen below.
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXX-X"></script>
<script>
function enableGoogleAnalytics() {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('config', 'UA-XXXXX-X');
}
</script>
Should I be injecting the first line dynamically (shown below) as well? If so, is there are a straightforward way?
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXX-X"></script>
Thanks,

Resources