无法使 cordova 中的活动与分析 v4 一起使用

Cant make campaigns in cordova work with analytics v4

我正在尝试为我的 Cordova 应用制作广告系列。

我正在使用这个插件:

https://github.com/Anu2g/google-analytics-plugin.git 支持活动

https://github.com/8zrealestate/android-referrer-plugin.git 用于检索引荐来源网址,所以我在分析插件中找不到获取它的方法

https://github.com/chrisekelley/AppPreferences.git 将保存在应用程序首选项中的引用链接到我的 javascript。

对于上下文,我使用的是 Cordova 4.3.0 和 google analytics v4

我的清单如下所示:

<receiver android:exported="true" android:name="com.eightz.mobile.cordova.plugin.android.referrer.Receiver">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
</receiver>

而且我正在尝试按照本指南进行操作:

https://developers.google.com/analytics/solutions/testing-play-campaigns

我已经尝试过在清单中使用和不使用此服务

<service android:name="com.google.android.gms.analytics.AnalyticsService"
 android:enabled="true"
 android:exported="false"/>

我也试过各种am广播

    am broadcast -a com.android.vending.INSTALL_REFERRER \
-n my.app/com.eightz.mobile.cordova.plugin.android.referrer.Receiver \
--es "referrer" "textinreferrer"

他们工作,他们 return

Broadcasting: Intent { act=com.android.vending.INSTALL_REFERRER cmp=my.app/com.eightz.mobile.cordova.plugin.android.referrer.Receiver (has extras) }
Broadcast completed: result=0

但是在 logcat 我收到 CampaignTrackingReceiver is not registered 错误,即使应用程序已关闭。

我也尝试过 GAv3 和 GAv4 接收器,但我无法使 campaignTrackingReceiver 工作,我仍然得到

CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See http://goo.gl/8Rd3yj for instructions.

或者什么都没有。

有人有什么想法吗?我错过了什么?提前致谢

我终于解决了,问题是我有两个接收器,Android搞砸了。使用此解决方案和三个插件,您可以使用 Cordova 中的真实数据跟踪活动。日志效果不是很好,但是您可以看到调试 javascript 的真实路径。祝你好运。