On my site, we have a custom dimension that we register on the Google Analytics config and then use it when we send our page view event:
gtag('config', 'UA-TrackingCode', {
'custom_map': {
'dimension1': 'CustomDim'
},
'send_page_view': false
});
gtag('event', 'page_view', {
'CustomDim': value
});
However, running this code sends a page view for all Google Analytics instances loaded on the page prior to ours (which is causing a very high bounce rate for others). I want this page view event to only register for my 'UA-TrackingCode' instance.
Is there a way to do this? Something similar to:
gtag('event', 'UA-page_view', {
'CustomDim': value,
'TrackingCode': 'UA-TrackingCode'
});
The correct way to do this is to use the "send_to" parameter:
gtag('event', 'page_view', {
'CustomDim': value,
'send_to': 'UA-TrackingCode'
});