0
votes

I have a page in my site "x" that redirect to another site "y".
So I wanted to track that redirect traffic and send it to Google analytics,
by this code :

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}

(function(url) {
  gtag('event', 'y', {
    'send_to': 'UA-xxxxxxxx-x',
    'event_category': 'out',
    'event_label': url,
    'transport': 'beacon',
    'event_callback': function(){document.location = url;}
  });
})("<?php echo $url; ?>");

When I go to see the Events in Google analytics for "X" I found 5000 event sent.
when I go to see the Referral Traffic in Google analytics for "y" I see only count 2500 mean half the traffic.

These analytics has the same time zone and the date.
So what cause the problems that make double counting the Events?

1
is site x and y accessible through http as well as https? - XTOTHEL
Yes, They redirect to https - Ali Coder
In that case you have to get align the comparable metrics first. On site X you're measuring events with your gtag code. Each event is tracked separately so if one of your visitors clicked the link twice there will be two events counted. On the other end on site Y you're probably looking at Referral traffic report that shows you the number of sessions. So a visitor that lands to site Y returns to site Y and the get back to site Y would count as one session. I'd suggest you comparing 'unique events' on site X and entrances on site Y to get a clearer picture of what happens - Дмитро Булах

1 Answers

0
votes

You're comparing two different metrics (events and users probably). One user can be redirected a million times and it will be still counted on the site Y as 1 user if it happens in one day.

The best QA is to open both sites' real-time analytics and execute the redirect with a parameter which will make sure you're watching your action. Then you should see an event hit on site X and a pageview on site Y.