跨应用程序跟踪phonegap应用程序

时间:2014-08-05 09:57:22

标签: android ios cordova tracking

我在appstore中有2个不同的应用程序,我将数据库(sql)中的一些数据保存为uid,ip,用户所在的页面等。

是否有办法为独特的访问者提供ID或类似内容,以便我可以跟踪这两个应用中的用户活动。

是否可以看到用户点击的按钮。

我已将谷歌分析添加到应用程序,但我只能看到com.example.mainactivity上有用户,而不是应用程序的html页面。

希望你们明白我的意思。

1 个答案:

答案 0 :(得分:0)

您可以使用Google分析以两种不同的方法解决此问题。您可以使用内置的userId功能,它甚至可以跟踪跨设备会话。

/**
 * An example method called when a user signs in to an authentication system.
 * @param User user represents a generic User object returned by an authentication system on sign in.
 */
public void onUserSignIn(User user) {
  // Be careful when creating new trackers -- it is possible to create multiple trackers for the
  // same tracking Id.
  Tracker t = GoogleAnalytics.getInstance(context).newTracker("UA-XXXX-Y");

  // You only need to set User ID on a tracker once. By setting it on the tracker, the ID will be
  // sent with all subsequent hits.
  t.set("&uid", user.getId());

  // This hit will be sent with the User ID value and be visible in User-ID-enabled views (profiles).
  t.send(new HitBuilders.EventBuilder().setCategory("UX").setAction("User Sign In").build());
}

或者,您可以使用Data Import功能从多个来源(例如CRM数据库和SQL数据库)导入外部用户信息,并且您需要将其用户表示映射到您自己的自定义维度。您可以按照“Importing User Data to create AdWords Remarketing Lists”文章中的示例进行操作。它显示了如何使用自定义维度来表示用户ID,然后上传有关该用户的更多自定义维度。

  ga('create', 'UA-XXXX-Y', 'auto');
  ga('require', 'displayfeatures');
  ga('set', 'dimension1', 'NNNN'); // Where NNNN represents the CRM User Id.
  ga('send', 'pageview');

请注意,Google Analytics不支持发送个人身份信息,see the TOS