Since we implemented the user_id tracking, we have a double counting issue in GA4. Screenshot
- I see that UA and GA4 are triggered twice in the network tab
I focus on GA4, one request is triggered without the user_id and user_properties, the second one is triggered with...
My issue is that my UA and GA4 tags are triggered only one time through my TMS. We observe a double counting since we implemented the user_id tracking.
We don't use GTM as TMS, but Piwik PRO. For UA, we used the Google Analytics template provided by Piwik (without user_id tracking). For GA4, we used the custom HTML and the gtag version:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXX', {
'page_location': location.hostname + location.pathname + location.hash
}
);
// set user_id and user properties
gtag('set', {'user_id': {{ DLV | User ID }}});
gtag('set', {'user_properties': {
'country': {{ DLV | Country }},
'language': {{ DLV | Language }},
}});
</script>
Would you have an idea why we have a double counting?
Many thanks for you help :)
I can confirm that the issue is linked to the user_id: on the page where we don't have the datalyer, we don't have the issue.