Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GA4 Web: Add section about Page Views toggle #5400

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

Merged
merged 3 commits into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ When enabled, the **Page Views** advanced setting sends the `page_view` event fr

The GA4 SDK also tracks a native `page_view` event if you have the [following setting enabled](https://developers.google.com/analytics/devguides/collection/ga4/views?client_type=gtag#measure_virtual_pageviews){:target='_blank'} in your GA4 account. To avoid the native GA4 `page_view` event, disable **Page changes based on browser history events** under the advanced settings of the **Page views** section.

### Disabling Page Views

The **Page Views** setting in the GA4 Web destination settings is toggled on by default. This means that the default **Set Configuration Fields** mapping sends a `page_view` for you when you enable GA4 Web as a destination. If you don't want to send a `page_view` by default, you can toggle the **Page Views** setting off in your destination settings. However, if you toggle the **Page Views** setting off, you need to account for the `page_view` to happen after the `config` since session attribution sets on the first event after the config is loaded, which is usally a `page_view`.

This means that `config` fires at `analytics.page()`, and `page_view` fires after on a `track` call (i.e. `analytics.track("Viewed Content"`). For proper tracking, the `config` must load prior to any GA4 event. For further troubleshooting, go to your DevTools console and type in “dataLayer” to view the order of events sent to Google Analytics. You can read more about [Manual Pageviews](https://developers.google.com/analytics/devguides/collection/ga4/views?client_type=gtag#manual_pageviews){:target='_blank'} in Google's documentation.


### Custom Event Naming

Expand Down Expand Up @@ -96,4 +102,4 @@ Without any further configuration, traffic-source data for `campaign`, `campaign

### Differences between Google Analytics 4 Cloud and Google Analytics 4 Web destinations

Segment's [Google Analytics 4 Cloud](/docs/connections/destinations/catalog/actions-google-analytics-4/) server-side destination uses Google's Measurement Protocol API to send event data server to server, whereas Segment's [Google Analytics 4 Web](/docs/connections/destinations/catalog/actions-google-analytics-4-web/) device-mode destination loads the gtag.js library client-side and uses Segment's event data to map to gtag.js events directly. Each destination has its own advantages and disadvantages. Your choice between the two will depend on your specific use case, technical expertise, and the platforms from which you want to track data.
Segment's [Google Analytics 4 Cloud](/docs/connections/destinations/catalog/actions-google-analytics-4/) server-side destination uses Google's Measurement Protocol API to send event data server to server, whereas Segment's [Google Analytics 4 Web](/docs/connections/destinations/catalog/actions-google-analytics-4-web/) device-mode destination loads the gtag.js library client-side and uses Segment's event data to map to gtag.js events directly. Each destination has its own advantages and disadvantages. Your choice between the two depends on your specific use case, technical expertise, and the platforms from which you want to track data.