InstallReferrerReceiver
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
当发生以下情况时,系统会广播 Google Play com.android.vending.INSTALL_REFERRER intent:
应用是从 Google Play 商店安装的。这个 BroadcastReceiver 会监听
Intent,将安装引荐来源数据传递到 GTM,以用于移动应用和 Google Analytics。
如需启用此接收器,请将以下内容添加到 AndroidManifest.xml 文件中:
<!-- Used for install referrer tracking-->
<service android:name="com.google.tagmanager.InstallReferrerService"/>
<receiver
android:name="com.google.tagmanager.InstallReferrerReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
此接收器会自动调用 Google Analytics 接收器,以便设置
广告系列数据。如果同时使用了 Google Analytics SDK 和 Google 跟踪代码管理器 SDK,
只需启用此接收器即可。
公共构造函数
<ph type="x-smartling-placeholder"></ph>
公开
InstallReferrerReceiver
()
公共方法
<ph type="x-smartling-placeholder"></ph>
公开
无效
onReceive
(上下文上下文、intent 意图)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],["The `InstallReferrerReceiver` class listens for the `com.android.vending.INSTALL_REFERRER` intent, which is broadcast upon app installation from the Google Play Store. Upon receiving this intent, it passes install referrer data to Google Tag Manager (GTM) and Google Analytics. To enable, it requires a service and a receiver declaration in the `AndroidManifest.xml`, specifying the intent action. The class features a constructor and an `onReceive` method that processes the received intent. It also sets campaign data for the Google Analytics.\n"]]