-
Notifications
You must be signed in to change notification settings - Fork 367
adding changes to GA4 topics #6262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
### Recommended events | ||
|
||
Google Analytics 4 requires the use of [recommended events](https://support.google.com/analytics/answer/9267735){:target="_blank"} and properties to power certain built-in reports. Segment’s Google Analytics 4 Web destination provides prebuilt mappings to automatically map your Segment spec events to the corresponding Google Analytics 4 events and properties. If your Segment events don’t follow the Segment spec exactly, you can modify the mappings. For example, Segment maps `Order Completed` events to the Google Analytics 4 `Purchase` event by default. If your company uses `Products Purchase` to indicate a purchase, you can map it in the Purchase action’s Event Trigger instead. | ||
Google Analytics 4 advises for the use of [Recommended events](https://support.google.com/analytics/answer/9267735){:target="_blank"} and properties to power certain built-in reports. Segment’s Google Analytics 4 Web destination provides prebuilt mappings to automatically map your Segment spec events to the corresponding Google Analytics 4 events and properties. If your Segment events don’t follow the Segment spec exactly, you can modify the mappings. For example, Segment maps `Order Completed` events to the Google Analytics 4 `Purchase` event by default. If your company uses `Products Purchase` to indicate a purchase, you can map it in the Purchase action’s Event Trigger instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Google Analytics 4 advises for the use of [Recommended events](https://support.google.com/analytics/answer/9267735){:target="_blank"} and properties to power certain built-in reports. Segment’s Google Analytics 4 Web destination provides prebuilt mappings to automatically map your Segment spec events to the corresponding Google Analytics 4 events and properties. If your Segment events don’t follow the Segment spec exactly, you can modify the mappings. For example, Segment maps `Order Completed` events to the Google Analytics 4 `Purchase` event by default. If your company uses `Products Purchase` to indicate a purchase, you can map it in the Purchase action’s Event Trigger instead. | |
Google Analytics 4 advises for the use of [Recommended events](https://support.google.com/analytics/answer/9267735){:target="_blank"} and properties to power certain built-in reports. Segment’s Google Analytics 4 Web destination provides prebuilt mappings to automatically map your Segment spec events to the corresponding Google Analytics 4 events and properties. If your Segment events don’t follow the Segment spec exactly, you can modify the mappings. For example, Segment maps `Order Completed` events to the Google Analytics 4 `Purchase` event when you add the `Purchase` action to your mappings. If your company uses `Products Purchase` to indicate a purchase, you can map it in the Purchase action’s Event Trigger instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for context - this was raised in PR #6248
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added several comment for changes and there are two missing links. Any changes I suggested for consent mode do not need to be included in this update.
src/connections/destinations/catalog/actions-google-analytics-4-web/ga4-faq-and-troubleshooting
Show resolved
Hide resolved
|
||
The client_id and the session_id are both cookies stored in the user browser. You can use [Google gtag get commands](https://developers.google.com/tag-platform/gtagjs/reference#get){:target=”_blank”} or other cookie methods to parse these values from the _ga cookie and _ga_measurementId cookie: | ||
If your _ga cookie is GA1.1.1783165678.1701112990 then 1783165678.1701112990 is your client_id | ||
If your _ga_M12454XDR cookie is GS1.1.1710342977.347.1.1710343074.0.0.0 then 1710342977 is you session_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit typo:
If your _ga_M12454XDR cookie is GS1.1.1710342977.347.1.1710343074.0.0.0 then 1710342977 is your session_id
For event data to be sent downstream to Google Analytics: | ||
|
||
1. The **Set Configuration Fields** mapping must be configured and enabled in your mappings. This mapping is required for data to be sent downstream because it sets configuration to the GA4 Measurement ID indicated in the Settings and establishes data flow using the `config` command. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove space
1. The **Set Configuration Fields** mapping must be configured and enabled in your mappings. This mapping is required for data to be sent downstream because it sets configuration to the GA4 Measurement ID indicated in the Settings and establishes data flow using the `config` command. | ||
|
||
2. Ensure that you're calling `analytics.page()` on page load. Analytics.js requires an initial Page call to send data to Google Analytics 4 Web. The Segment snippet includes this initial call by default. | ||
3. Send data with an event, typically this is a page_view as your first event. Note: If you toggled “On” Page Views in your Settings, then the page_view event will automatically send when Set Configuration Mapping is triggered. If you need to override this setting for your particular use case, read {{link to this section: ### Can I override my send_page_view selection that I declared in the Settings?}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add link... my notes were a placeholder
|
||
### Duplicate `page_view` events in GA4 | ||
|
||
If you are sending multiple `gtag(‘config’)` commands called from Set Configuration mapping on one page before a new DOM has loaded, and you have defined `send_page_view: true` with each ‘Config’ event, you may see duplicate `page_view` events sent to your GA4 measurement id. . If this is the case, please refer to Google's documentation on [Ignoring duplicate instances of on-page configuration](https://support.google.com/analytics/answer/9973999?hl=en#:~:text=as%20described%20below.-,Ignore%20duplicate%20instances%20of%20on%2Dpage%20configuration,Click%20Save.,-Give%20feedback%20about){:target="_blank"}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo after "events sent to your GA4 measurement id." There are two periods.
3. Click the toggle on for **Enable Consent Mode**. | ||
4. Set the following fields with these values: | ||
3. Click the toggle on for **Enable Consent Mode**, this calls gtag(‘consent’,’default’) with the defined parameters when the gtag library loads. | ||
4. Set the following fields with your organization’s determination of granted or denied: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove change
Default Ad Storage Consent State | Granted or Denied | ||
Default Analytics Storage Consent State | Granted or Denied | ||
Ad User Data Consent State | Granted or Denied | ||
Ad Personalization Consent State | Granted or Denied |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove changes on 92-95
@@ -101,7 +103,7 @@ To enable consent mode for your Google Analytics 4 Web destination: | |||
'Analytics Storage Consent State': 'false' | |||
}); | |||
``` | |||
7. As soon as the page loads and the set configuration fires to the Google Analytics SDK, Segment issues a consent mode update command. Map the properties you defined to collect consent state changes to the Set Configurations Fields mapping. You can choose to do this from 1 of 2 options in steps 4 and 5. | |||
7. As soon as the page loads and the set configuration fires to the Google Analytics SDK, Segment issues a consent mode update command. Map the properties you defined to collect consent state changes to the Set Configurations Fields mapping. You can choose to do this from 1 of 2 options in steps 4 and 5. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
@@ -111,68 +113,14 @@ To enable consent mode for your Google Analytics 4 Web destination: | |||
* Ad User Data Consent State | |||
* Ad Personalization Consent State | |||
You can manually select `Granted` or `Denied` from the dropdown menu for Advanced consent mode settings, and type in `granted` or `denied` for basic consent mode settings. | |||
5. *(Option 2)* Under the **Select mappings** section, create an event variable to directly grab the value from the payload (for example, `properties.adStorageConsentState`). Ensure it translates to `granted` or `denied`. You can use an insert function to translate to `granted` or `denied`. Use the replace function if it's a string. Do this for these fields: | |||
5. *(Option 2)* Under the **Select mappings** section, create an event variable to directly grab the value from the payload. For example, `properties.adStorageConsentState`. Ensure it translates to `granted` or `denied`. You can use an insert function to translate to `granted` or `denied`. Use the replace function if it's a string. Do this for these fields: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
* Ads Storage Consent State | ||
* Analytics Storage Consent State | ||
* Ad User Data Consent State | ||
* Ad Personalization Consent State | ||
|
||
When these properties are available, they send to the `update` command. | ||
When these properties are available, they send to the `update` command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of changes and I think we'll be good to go. If you have any questions about my suggestions, let me know! @rvadera12
src/connections/destinations/catalog/actions-google-analytics-4-web/ga4-faq-and-troubleshooting
Outdated
Show resolved
Hide resolved
src/connections/destinations/catalog/actions-google-analytics-4-web/ga4-faq-and-troubleshooting
Outdated
Show resolved
Hide resolved
src/connections/destinations/catalog/actions-google-analytics-4-web/ga4-faq-and-troubleshooting
Outdated
Show resolved
Hide resolved
src/connections/destinations/catalog/actions-google-analytics-4-web/ga4-faq-and-troubleshooting
Outdated
Show resolved
Hide resolved
src/connections/destinations/catalog/actions-google-analytics-4-web/ga4-faq-and-troubleshooting
Outdated
Show resolved
Hide resolved
src/connections/destinations/catalog/actions-google-analytics-4-web/index.md
Outdated
Show resolved
Hide resolved
src/connections/destinations/catalog/actions-google-analytics-4-web/index.md
Outdated
Show resolved
Hide resolved
src/connections/destinations/catalog/actions-google-analytics-4-web/index.md
Outdated
Show resolved
Hide resolved
src/connections/destinations/catalog/actions-google-analytics-4-web/index.md
Outdated
Show resolved
Hide resolved
src/connections/destinations/catalog/actions-google-analytics-4-web/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: forstisabella <[email protected]>
Co-authored-by: forstisabella <[email protected]>
Co-authored-by: forstisabella <[email protected]>
Co-authored-by: forstisabella <[email protected]>
Co-authored-by: forstisabella <[email protected]>
src/connections/destinations/catalog/actions-google-analytics-4-web/ga4-faq-and-troubleshooting
Outdated
Show resolved
Hide resolved
…4-web/ga4-faq-and-troubleshooting
Thank you for your contribution! Your pull request is merged, but may take a day or two to appear on the site. |
https://segment.atlassian.net/browse/DOC-840