AnalyticsReceiver in Google Analytics Tracking

2019-07-22 04:30发布

In Google Analytics Tracking Ver1, it has class AnalyticsReceiver.

But when I used Google Analytics Tracking Ver2, it hasn't got AnalyticsReceiver class. I don't know which class should I use instead.

In manifest declared when use Google Analytics Tracking:

<receiver
    android:name="com.google.analytics.tracking.android.AnalyticsReceiver"
    android:exported="true" >
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

Can you help me.

1条回答
劫难
2楼-- · 2019-07-22 05:01

Google seems to move this class with every release. Depending on your Google Analytics SDK version, the value for android:name will change. Here's all of the various versions for anyone else upgrading beyond v2.

Google Analytics SDK v2: com.google.analytics.tracking.android.CampaignTrackingReceiver

<receiver
    android:name="com.google.analytics.tracking.android.CampaignTrackingReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

Google Analytics SDK v3: com.google.android.apps.analytics.AnalyticsReceiver

<receiver
    android:name="com.google.android.apps.analytics.AnalyticsReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

Google Analytics SDK v4: com.google.android.gms.analytics.CampaignTrackingReceiver

<receiver
    android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>
查看更多
登录 后发表回答