Reputation: 452
I have a website where two separate Google Analytics properties are used for tracking.
The first is:
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-11111111-1');
</script>
The second is:
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-22222222-2');
</script>
I'm also tracking the following event:
gtag('event', 'pageview', {'event_category': 'LoadContent'});
At the moment, the same event is being tracked across both GA properties, however, I only want it to be tracked for the first one. How can I specify that? I searched everywhere online but couldn't find the answer.
Upvotes: 0
Views: 40
Reputation: 5198
You can do
gtag('event', 'pageview', {
'event_category': 'LoadContent',
'send_to': 'UA-11111111-1'
});
sned_to will allow you to specify which property you want to send it to.
Upvotes: 1