Unable to get the referrer information - google-analytics

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.

Related

Prevent gtag / global site tag from tracking initial page load

We have a single page application using Gtag (Global Site Tag), and we manage the tracking of pages manually to provide the correct page names that we want to track. So we call
gtag('config', gaPropertyId, gtagPageConfig)
every time there is a route change.
This means that we don't want gtag to track pages for us automatically, as we are currently tracking all initial pages twice. The first is when gtag is automatically firing the tracking of the page by sending the browser title and the URL, and the second time is when we trigger the page view from our code, to provide the title for that page that we want to have see in Google Analytics.
After a lot of research and debugging, I've narrowed it down to the settings screen, where "Page loads" is checked, and can't be disabled, see this image:
We load our script like this:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxx-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-xxx', { 'send_page_view': false });
</script>
When I remove the line gtag('js', new Date());, it doesn't track the page anymore, but this will probably result in some unwanted behaviour.
Is there a way for us to prevent the initial page load tracking? I've searched everywhere, but can't find the solution.
Simply you should NOT include those fields on pages you don't want to send any data to Google:
gtag('js', new Date());
gtag('config', 'G-xxx');
Your snippet should look like this without date and config:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-xxx"></script>
<script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}
Sending data
SPA (i.e. Vue, React, etc)
If you are using SPA (i.e. Vue, React), you can run gtag function after route updated:
gtag('js', new Date());
gtag('config', 'G-xxx', { page: path: route.path, page_title: route.meta.title })
PHP
You can show up date and config conditionally:
<?php if (/* suits my needs*/): ?>
gtag('js', new Date());
gtag('config', 'G-xxx');
<?php endif; ?>
Documentation says about measure pageviews:
To disable the default pageview hit, set the send_page_view parameter to false in the gtag.js snippet.
gtag('config', 'GA_MEASUREMENT_ID', {
send_page_view: false
});
https://developers.google.com/analytics/devguides/collection/gtagjs/pages

Google Analytics gtag doesn't count

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.

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)

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