I'm currently integrating Google Analytics tracking into my application, and I have a specific question about handling different domains.
Domain 1: Website (e.g., https://mywebsite.com)
I want to track all enhanced measurements created by Google Analytics as well as custom events.
(Sub-)Domain 2: Webapp (e.g., https://app.mywebsite.com)
I only want to track custom-triggered events like sign_up or login.
The problem I'm facing is that I can't seem to disable enhanced measurement events ONLY for the web app. My current configuration looks like this (I'm using react-ga4):
ReactGA.initialize('G-XXXXXXX', {
gaOptions: {
send_page_view: false, // Not working
transport_url: 'https://metrics.mywebsite.com',
},
gtagOptions: {
enhanced_measurement_settings: {
scrolls: false, // Not working
},
},
gtagUrl: 'https://metrics.mywebsite.com/gtag/js',
});
Is it possible to disable these standard enhanced events via JavaScript? If not, what is the correct method to implement this?