Send events to Google Analytics 4 using RudderStack web device mode.
RudderStack lets you send your event data to Google Analytics 4 destination via device mode using the native web SDK, using the gtag tagging method.
You need to select gtag.js as the Client Type and enable Use device-mode to send events in the RudderStack dashboard to send events via device mode. For more information on device mode settings in the RudderStack dashboard, see Setting up Google Analytics 4 guide.
The identify call lets you identify a visiting user and associate them to their actions. It also lets you record the traits about them like their name, email address, etc.
User-ID is an advanced feature that lets GA4 present a cross-device, cross-platform view of your customers’ behavior. Google Analytics 4 uses userId and deviceId (GA’s cid value from Universal Analytics terminology) to identify users.
In the above snippet, the userId is set to 1hKOmRA4el9Zt1WSfVJIVo4GRlm and the name and email is set as user_properties.
The page call lets you record your website’s page views with any additional relevant information about the viewed page.
Google Analytics 4 gtag sends a page_view event to Google Analytics by default every-time it is loaded. You can also send page_view event to Google Analytics whenever you make an explicit page() call to RudderStack SDK.
RudderStack sends the following properties by default:
url mapped to page_location
title mapped to page_title
referrer mapped to page_referrer
You can also make page() call with any custom and standard properties as shown below:
The track call lets you capture user events along with the properties associated with them.
A sample track call is as shown:
RudderStack SDK sends the track event name and any properties as custom properties to Google Analytics 4.
RudderStack SDK flattens the properties that are nested and not standard Google Analytics 4 properties before sending them to Google Analytics.
There are limits on the number of custom properties per event that can be sent to Google Analytics 4. The RudderStack SDK does not drop the payload based on these limits. If the events are don’t show up in the debug view or in the Google Analytics dashboard reports, refer to the Google support page to learn more about the collection limits.
The group call lets you link an identified user with a group such as a company, organization, or an account, and record any traits associated with that group, for example, company name, number of employees, etc.
RudderStack maps the group call to the join_group event by default.
If you set sendUserId to false, RudderStack will not send userId to GA4 in any of the events.
How can I enable Google Signals in GA4?
Google Signals helps you understand the interaction of users with your website across multiple devices and sessions. To enable Google Signals and capture user data, the following conditions must be met:
A user must be signed in to their Google Account on the website or app.
Ad Personalization must be enabled for their account.
The Google Signals feature is available in the web device mode only.
To enable Google Signals in GA4 and reflect the collected user data in your reports, follow the steps below:
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
for the working of basic functionalities of the website. We also use third-party cookies that
analyze and understand how you use this website. These cookies will be stored in your browser
consent. You also have the option to opt-out of these cookies. But opting out of some of these
have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.