Before configuring Google Analytics 4 as a destination in RudderStack, verify if the source platform is supported by Google Analytics 4 by referring to the table below:
Connection Mode | Web | Mobile | Server |
---|---|---|---|
Device Mode | Supported | - | - |
Cloud Mode | Supported | Supported | Supported |
Once you have confirmed that the source platform supports sending events to Google Analytics 4, follow these steps:
- From your RudderStack dashboard, add the source. Then, from the list of destinations, select Google Analytics 4.
- Assign a name to your destination and click on Continue.
Connection settings
To successfully configure Google Analytics 4 as a destination, configure the following settings:
API Secret: This field is required only for the cloud mode setup where you can enter the API Secret generated through the Google Analytics dashboard. It can be created in the Google Analytics dashboard under Admin > Data Streams > Choose your stream > Measurement Protocol > Create.
Client Type: Select the client type as
gtag
orFirebase
from the dropdown:gtag
- Supported for the cloud and device mode both. If you selectgtag
, enter the below:- Measurement Id: Enter the Measurement Id which is the identifier for a data stream. It can be found in the Google Analytics dashboard under Admin > Data Streams > Choose your stream > Measurement ID.
Firebase
- Supported only for the cloud mode. If you selectFirebase
, enter the below settings:- Firebase App Id: Enter the Firebase App ID which is the identifier for Firebase app. It can be found in the Firebase dashboard under Project Settings > General.
Identify
- Enable Server Side Identify: Enable this setting to make an
identify
call.
If Enable Server Side Identify setting is enabled, you can also configure the following settings:
Trait to differentiate between new or existing user: Enter a trait key to determine whether a user is new or an existing user.
Convert identify event to Login or Signup event: Enable this setting to convert the
identify
event to alogin
event in case of an existing user or asign_up
event in case of a new user.Trait key for the 'method' parameter in Login or Signup event: Enter the trait key to pass the
method
parameter in thelogin
orsign_up
event.Send 'generate_lead' event for 'identify' event: Enable this setting to send a
generate_lead
event for a new user.Note that thegenerate_lead
event will only be fired for the new users and not for the existing ones.When enabled and it is a new user, you also need to enter the following details:
- Value - traits for lead generation: Enter the value key to pass the
value
parameter for thegenerate_lead
event. - Currency - traits for lead generation: Enter the currency key to pass the
currency
parameter for thegenerate_lead
event.
- Value - traits for lead generation: Enter the value key to pass the
identify
call payload for more information on sending identify
events to GA4 via cloud mode.Native SDK
- Block a Page View Event: Enable this setting to disable sending
page_view
events on load. However, you can explicitly send apage_view
event by calling thepage()
API. - Extend Page View Property: Enable this setting to send the following properties along with any other custom property to the
page
call of the RudderStack SDK:url
search
page_view
event supports the properties mentioned in the Automatically collected events in Google Analytics 4 guide.Send userId to GA: This setting exhibits the following behavior:
- If enabled, the user ID is set to the identified visitors and sent as explained in the Cookies and user identification guide.
- If disabled,
userId
is not sent and Rudderstack only sends the user traits set asuser_properties
to Google Analytics. The user properties are set on thegtag
client as explained in the Set user properties guide.
Client-side events filtering
This option is applicable only if you're sending events to Google Analytics 4 via the web device mode. Refer to the Client-side Event Filtering guide for more information on this feature.
Web SDK settings
Use device mode to send events: Enable this setting to send events via the device mode.
Finally, click on Next to enable Google Analytics 4 as a destination in Rudderstack.
FAQ
How do I obtain the Measurement Id?
- Login to Google Analytics dashboard.
- Go to the Admin section in the left sidebar.
- Select the relevant account and property.
- Click on Data Streams and select the stream to get the Measurement Id as shown:
How do I obtain the API Secret?
- Login to Google Analytics dashboard.
- Go to the Admin section in the left sidebar.
- Select the relevant account and property.
- Click on Data Streams and select the stream.
- Click on Measurement Protocol API secrets to get the API Secret as shown:
How do I obtain the Firebase App ID?
- Login to Google Analytics dashboard.
- Go to the Admin section in the left sidebar.
- Select the relevant account and property.
- Click on Data Streams and select the stream to get the Firebase App Id as shown:
Contact us
For queries on any of the sections covered in this guide, you can contact us or start a conversation in our Slack community.