Reputation: 31
We would like to send GA4 event data to 2 different GA4 Measurement Ids. Can gtag.js be configured to do this?
We know this can be configured for UA and GA4, but what about two or possibly more GA4 Measurement Ids?
Upvotes: 1
Views: 1252
Reputation: 2372
Yes you can set up the gtag like thie
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-111111111"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-111111111');
gtag('config', 'G-222222222');
gtag('config', 'G-333333333');
</script>
Then when you fire event:
<script>
gtag('event', 'test', {
'test_p1': 'test_v1'
});
</script>
You will send the ga4 event hits to all the config measurement in gtag.
But if you have more complicated requirements like
Event A to all config
Event B to some of the config
Please take a look at the document
Upvotes: 2