You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 14, 2025. It is now read-only.
I am trying to use react-ga4 on a brand new site with GA4. I have no previous UA requirements. The current initialize command is not transparent enough and seems to default to legacy settings. For example, if I just call GA4.initialize("MY_MEASUREMENT_ID") the following command is sent:
There is no documentation on what legacyDimensionMetric does but if call GA4.initialize("MY_MEASUREMENT_ID", { legacyDimensionMetric: false }) then this command is sent:
The only way around this appears to be manually setting send_page_view to true by calling GA4.initialize("MY_MEASUREMENT_ID", { legacyDimensionMetric: false, gtagOptions: { send_page_view: true } }) which results in the following command being sent:
This works but it would be great if there was a separate initialize command or an option to initialize using the default command only with no additional config info as per Google documentation i.e. gtag('config', 'MY_MEASUREMENT_ID').
The text was updated successfully, but these errors were encountered:
Hi,
I am trying to use react-ga4 on a brand new site with GA4. I have no previous UA requirements. The current initialize command is not transparent enough and seems to default to legacy settings. For example, if I just call
GA4.initialize("MY_MEASUREMENT_ID")
the following command is sent:Processing GTAG command: ["config", "MY_MEASUREMENT_ID", {send_page_view: false, custom_map: {dimension1: "dimension1", metric1: "metric1", ..., metric200: "metric200"}}]
There is no documentation on what legacyDimensionMetric does but if call
GA4.initialize("MY_MEASUREMENT_ID", { legacyDimensionMetric: false })
then this command is sent:Processing GTAG command: ["config", "MY_MEASUREMENT_ID", {send_page_view: false}]
So by default the current initialize command overrides the default send_page_view setting according to https://developers.google.com/analytics/devguides/collection/gtagjs/pages#manual_pageviews
The only way around this appears to be manually setting send_page_view to true by calling
GA4.initialize("MY_MEASUREMENT_ID", { legacyDimensionMetric: false, gtagOptions: { send_page_view: true } })
which results in the following command being sent:Processing GTAG command: ["config", "MY_MEASUREMENT_ID", {send_page_view: true}]
This works but it would be great if there was a separate initialize command or an option to initialize using the default command only with no additional config info as per Google documentation i.e.
gtag('config', 'MY_MEASUREMENT_ID')
.The text was updated successfully, but these errors were encountered: