设置 Google Analytics 4

Google Analytics 4 是一家已与 Adjust 集成的数据分析合作伙伴。我们的集成允许 Google Analytics 4 通过自动回传接收 Adjust 监测的数据。您可以使用合作伙伴的工具进行数据分析并获取洞见。

在本文中了解如何为您的应用设置 Google Analytics 4 监测,其中包括激活集成,以及选择 Adjust 可以与 Google Analytics 4 分享的数据。

操作前须知

要求​

iOS | 安卓 | Windows | Unity | React Native | Flutter | Adobe Air | Cordova | Marmalade | Xamarin | Cocos2d-x | Titanium | Corona

凭证​

Firebase App ID (for mobile apps), Measurement ID (for web apps), API Secret

  • 如需帮助查找凭证,请联系您的 Google Analytics 4 代表。

在您的 Google Analytics 4 控制面板中:​

要获取 Firebase App ID:

  1. 前往Firebase 控制台
  2. 找到并点击您的项目
  3. 在左侧面板中点击齿轮图标 > 项目概览 (Project Overview) 旁的项目设置 (Project settings)
  4. 在您的应用 (Your apps) 下选择您的应用并在 App ID 下找到 Firebase App ID

要获取 API 密钥:

  1. 前往Google Analytics 控制面板
  2. 选择管理 (Admin) > 数据收集和修改 (Data collection and modification) > 数据流 (Data streams)
  3. 选择应用的数据流,然后在 Measurement Protocol API 密钥 (Measurement Protocol API secrets)> 密钥值 (Secret value) 下找到您的 API 密钥
  4. 如果没有 API 密钥,请在 Measurement Protocol API 密钥下选择创建,输入名称并创建

在 Campaign Lab 中选择 Google Analytics 4 和应用

  1. 找到 Campaign Lab​ ,选择 合作伙伴​ 。
  2. 选择 新合作伙伴​ > Google Analytics 4​ 。选择 下一步​ 进入下一界面。
  3. 在 应用选择​ 界面选择要创建链接的应用,启用集成来与 Google Analytics 4 分享数据。
  4. 选择 下一步​ 。

启用数据分享

启用数据分享以激活与 Google Analytics 4 的集成。要启用数据分享:

  1. 输入您的 Firebase App ID (for mobile apps), Measurement ID (for web apps), API Secret。

启用与 Google Analytics 4 的数据分享后,Adjust 会默认自动向 Google Analytics 4 发送以下数据:

  • 安装
  • 再归因

设置数据分享

如果您的多平台应用启用了多个平台的数据分享,那么可以:

  1. 通过选择 使用平台特定设置​ 来在平台层级区分数据共享设置。
  2. 通过选择 使用全局设置​ 来为多个平台应用相同的数据共享设置。

在 哪些数据会默认分享?​ 部分, 查看 Adjust 默认与 Google Analytics 4 分享的活动:

  • 安装
  • 再归因

发送额外数据

选择您想通过回传与 Google Analytics 4 分享的数据量和数据类型。Google Analytics 4 可能会使用此信息来优化表现。

要发送额外数据,您可以查看并自定义以下选项:

应用内收入 (来自应用内购买)

通过应用内收入分享,Google Analytics 4 可以接收收入金额以及您的收入事件数据。您需要映射能产生收入的事件,才能分享该数据。

映射事件

将您想分享的事件映射到 Google Analytics 4 可以接收的值。未映射事件的数据不会被发送至 Google Analytics 4。

映射单个事件

如果您的应用为多平台应用,则可以选择按平台与 Google Analytics 4 分享不同事件。这有助于您:

  • 通过设定单个事件来管理不同平台的推广活动策略。
  • 按平台自定义数据分享。

在 映射事件​ 中,按照以下步骤选择要直接发送至 Google Analytics 4 的应用内事件。

  1. 选择 映射事件​ 。

  2. 在 Adjust 事件​ 列表中,选择要与 Google Analytics 4 分享的 Adjust 事件。

  3. 在 合作伙伴事件​ 下,您需要选择与 Adjust 事件对应的 Google Analytics 4 事件。

    1. 对于单平台应用和仅针对一个平台启用了数据共享的多平台应用,您只能针对一个平台映射事件。对于针对多个平台启用了数据共享的多平台应用,您可以:

      • 选择 使用平台特定映射​ 来在平台层级映射单独事件或不针对某些平台映射事件。
      • 选择 使用全局映射​ 来为所有平台映射相同的事件。
    2. 打开 合作伙伴​ 列表,选择要映射到 Adjust 事件的渠道事件,或输入自定义事件名称。

  4. 选择 确认​ 。

现在 Google Analytics 4 将接收每个关联事件的应用内事件数据。

映射全部事件

如果 Google Analytics 4 支持自动映射所有事件,则在 映射事件​ 下选择 映射全部事件​ ,这能够省去映射单个事件的时间。

现在 Google Analytics 4 将接收所有关联事件的应用内事件数据。

映射参数

要与 Google Analytics 4分享自定义数据,您通常需要映射参数。

合作伙伴参数 (在 Adjust SDK 4.0+ 版本中提供) 允许 Adjust 从您的应用中收集自定义数据点,并将其发送至 Google Analytics 4。借此,Google Analytics 4 可以接收每个已关联事件的自定义事件详情。

在向 Adjust SDK 添加新的合作伙伴参数之前,请确保现有的合作伙伴参数均不符合您的要求。

如需与 Google Analytics 4 分享合作伙伴参数,请遵循以下步骤。

  1. 在 Adjust SDK 中设置合作伙伴参数。

  2. 在 设置数据分享​ 下,选择 参数​ 。

  3. 打开 映射参数​ ,选择如何向渠道发送 SDK 中指定的合作伙伴参数。

    1. 选择 映射参数​ 。
    2. 在 SDK 参数​ 字段中输入要与渠道分享的 SDK 参数名称。
    3. 在 合作伙伴参数​ 字段中输入 SDK 参数对应的渠道参数。
请注意:

如果您在 Adjust SDK 中设置了合作伙伴参数而没有在控制面板中设置参数分享,那么 Adjust 会按照 Adjust SDK 中的名称发送参数。

为您的应用启用 Google Analytics 4

在 设置概览​ 界面,您可以检查自己的选择,也可以返回并更改以下内容:

  • 所选应用
  • 数据分享选项

选择 启用合作伙伴​ ,为您的应用启用 Google Analytics 4 。数据分析合作伙伴不使用推广活动链接。启用合作伙伴后,我们的集成会通过自动回传发送归因和应用内事件数据。

合作伙伴特定设置说明

Our Google Analytics 4 (GA4) integration​ allows Adjust to send cross-network attribution data to Google Analytics. You should enable this integration if you are already logging conversions with the Google Analytics for Firebase SDK​ or using Google Analytics 4 for web​. Adjust leverages the campaign_details event of the Measurement Protocol API​ to send conversions along with attribution details.

Requirements

This integration supports both mobile apps and web-based apps​:

  • For mobile apps:​
    • The Firebase SDK​ must be integrated into your app.
    • A Firebase App ID​ is required.
    • You must implement session partner parameters​ within the Adjust SDK to capture and send Google Analytics 4’s app_instance_id.
    • You should set app_instance_idbefore initializing the Adjust SDK​.
  • For web-based apps:​
    • A Measurement ID​ from your GA4 web property is required.
    • You must implement session partner parameters​ within the Adjust SDK to capture and send Google Analytics 4’s client_id.
    • You should set client_idbefore initializing the Adjust SDK​.

These identifiers (app_instance_id for mobile, client_id for web) are essential because Google Analytics 4 uses them to uniquely identify each user or app instance. If these values are not properly tracked and passed, Adjust will not be able to fire callbacks to Google Analytics.

Follow the guides linked below to use this feature:

iOS / Android / Unity / Flutter / React Native

Supported in-app events

The Google Analytics 4 integration supports the following in-app events:

  • Add to cart​
  • View cart​
  • Begin checkout​
  • Login​
  • Purchase​
  • Add to wishlist​
  • Sign up​

Some events require additional values to be passed as SDK Partner Parameters​:

In-app event Required SDK Partner Parameters
Add to cart item_id or item_name
View cart item_id or item_name
Begin checkout item_id or item_name
Login None
Purchase item_id or item_name, and transaction_id
Add to wishlist item_id or item_name
Sign up None

Make sure you pass the required SDK Partner Parameters when triggering these events. If the required parameters are missing, Adjust cannot send the event to Google Analytics 4 with the information required by the integration.

Additional Notes

  • Organic traffic​ is not shared​ via this integration.
  • Due to differences in attribution methodology, Google Analytics does not accept conversions older than 3 days​.
  • Depending on your Adjust Link attribution windows​, you might see discrepancies because some conversions may not be reported in GA4.

About Session ID

You can send the Firebase Session ID through the session partner parameter ga4_session_id​.

About User ID

You can send the Firebase User ID through the session partner parameter ga4_user_id​.

转发给 Google Analytics 4 的所有参数列表

Google Analytics 4 要求 Adjust 在回传中发送以下参数 (数据点):

PlaceholderInformation
{currency}Original ISO 4217 currency code sent from Adjust SDK
{revenue_float}Revenue, as sent from Adjust SDK, in whole currency units
{adgroup_name}Adgroup name, as taken from the tracker
{campaign_name}Campaign name, as taken from the tracker
{creative_name}Creative name, as taken from the tracker
{engagement_time}Engagement timestamp
{network_name}Network name, as taken from the tracker