如何正确使用和跟踪应用程序邀请? [英] How to correctly use and track App-invites?

查看:176
本文介绍了如何正确使用和跟踪应用程序邀请?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google允许执行应用邀请并跟踪他们改进应用安装的情况。

p> https://www.youtube.com/watch?v=UfdCNYXMC9M



问题



我做了一个简单的应用程序邀请,似乎人们使用它,使用以下代码:

  public static Intent getAppInviteIntent(Context context){
return new AppInviteInvitation.IntentBuilder(title,appName).setCustomImage imageUri).setMessage(消息).setCallToActionText(下载).build();
}


startActivityForResult(getAppInviteIntent(this),GOOGLE_APP_INVITES_REQUEST_CODE);

这个方法可行,但在 Analytics网页 ,我无法找到显示应用邀请统计信息的方法,即使他们说这是自动( 这里 )。不幸的是,即使我发现它看起来很老,他们使用不赞成的函数。

我已经尝试



<我认为也许它不是自动的(因为教程也有一些额外的接收器部分的代码, here ),我们可能需要添加一些代码,如 这个文档 说:


当用户接受邀请并安装应用程序时,getInvitation(GoogleApiClient,Activity,boolean)会更新邀请状态以安装,并以意向使用getInvitationIntent()从AppInviteInvitationResult进行访问


查看Google的示例( here ),我注意到他们创建了2个活动。一个是主要的活动,它有一个getInvitation的调用,另一个被称为DeepLinkActivity,并处理深层链接(这可能是额外的数据,如优惠券)。

我也发现了一些关于跟踪的stackoverflow问题(比如 这里 ),但我所看到的是人们没有成功跟踪。

问题




  1. 视频中显示,为了跟踪邀请以及他们的工作情况,最小的代码是什么? Google Analytics页面本身应该配置什么?目前我并没有使用深度链接,所以我不想使用它。

  2. 看来Google已经将app-invites功能转移到了firebase gradle存储库。这是必须的吗?有什么优势?我们目前使用以前的(com.google.android.gms:play-services-appinvite:...)。 FireBase的仪表板似乎没有包含与Google Analytics一样多的分析用户界面。
  3. 如果#1的答案是我需要使用getInvitationIntent,它是否必须在主要应用程序的活动?它是否必须在一个活动(可能broadcastReceiver?)?

  4. 似乎也可以邀请到IOS(如 here here ,使用setOtherPlatformsTargetApplication )。它是否正确?它是如何工作的?当IOS用户点击链接时会发生什么?什么应该被放入clientId的参数,我从哪里得到它?


  5. G +有app-invites吗?如果是这样,它是否也有分析?



解决方案

我会尽我所能来回答一切。请询问是否需要澄清。



Google Analytics(分析)跟踪需要使用setGoogleAnalyticsTrackingId(String trackingId)设置的跟踪ID,我在您的示例中没有看到该ID。然后,这个跟踪代码被传递给下游事件,记录分析跟踪事件:


  • 当发送邀请(电子邮件和短信) 。

  • 当邀请用户通过点击邀请链接或按钮来接受邀请时。
  • 当开发者调用getInvitation()

  • 当开发人员调用convertInvitation()时,为了回答您的具体问题,可以这样:

  • 如上所述,只需将您的跟踪ID添加到构建器中,即可报告所有跟踪事件。不需要深层链接,这对于邀请是可选的。
  • 是的,appinvites api被复制到firebase,同时保留原始内容。现在他们完全一样。未来的改进将会在firebase中进行,所以如果有时间的话就进行迁移。getInvitationIntent()被调用getInvitation()的回调函数返回的结果,所以回调函数应该在一个activity 。此外,由于您只会在启动后立即收到邀请,因此您只需检查主要活动以及将从深层链接上触发的意向过滤器启动的任何活动。听起来像你不使用深层链接,所以只有主要活动。一般来说,您应该从可以直接从邀请中直接启动的所有活动中调用getInvitation(),这是您如何确定您的应用程序是否从邀请启动的方式。

  • 是的,邀请可以交叉 - 平台在两个方向,iOS - > Android和Android - > iOS。您需要在console.developers.google.com的同一个项目中定义这两个应用程序,这些项目是关联它们所必需的。如果项目中有多个iOS应用程序,则必须使用api调用来消除与Android应用程序配对的iOS应用程序。使用凭据下拉菜单部分创建OAuth客户端ID时,将在控制台中生成ClientID参数。

  • 没有任何单独的G +邀请。


  • Background

    Google allows to perform app-invites and also track how well they improve your app installations:

    https://www.youtube.com/watch?v=UfdCNYXMC9M

    The problem

    I made a simple app invite, and it seems people do use it, using this code:

    public static Intent getAppInviteIntent(Context context) {
        return new AppInviteInvitation.IntentBuilder(title,appName).setCustomImage(imageUri).setMessage(message).setCallToActionText(download).build();
    }
    
    
    startActivityForResult(getAppInviteIntent(this), GOOGLE_APP_INVITES_REQUEST_CODE);
    

    This works, but in the Analytics webpage, I can't find a way to show the statistics of the app-invite, and that's even though they say it's automatic (here). Sadly, even what I've found seem quite old and they use deprecated functions.

    What I've tried

    I thought that maybe it's not quite automatic (because the tutorial has some extra code for the receiver part too, here), and that we might need to add some code, as this docs say :

    When the user accepts an invitation and installs the app, getInvitation(GoogleApiClient, Activity, boolean) will update the invitation state to installed and return the invitation data in an intent accessed from AppInviteInvitationResult using getInvitationIntent()

    Looking at Google's sample (here), I've noticed they created 2 activities. One is the main activity, which does have a call to "getInvitation" , and another is called "DeepLinkActivity" , and handles deep links (which is probably for extra data, like coupons).

    I've also found some stackOverflow questions about the tracking (like here), but all I see is that people didn't succeed tracking yet.

    The questions

    1. What is the minimal code needed in order to track the invitations and how well they work, as shown on the video? What should be configured in Analytics page itself? I don't use deep linking currently, so I don't want to use it.

    2. It seems that Google moved the app-invites feature to "firebase" gradle repositories. Is it a must-have? What are the advantages? We currently use the previous ones ("com.google.android.gms:play-services-appinvite:..." ). The dashboard of FireBase doesn't seem to include as much UI for analytics as Google Analytics. Not to mention of app-invites.

    3. If the answer to #1 is that I need to use "getInvitationIntent", does it have to be on the main activity of the app ? Does it have to be in an activity at all (maybe broadcastReceiver?) ?

    4. It seems it's possible to also invite to IOS too ( as shown here and here, using "setOtherPlatformsTargetApplication"). Is this correct? How does it work? What happens when an IOS user clicks the link? What should be put into the parameter of "clientId" and where do I get it from ?

    5. Does G+ have app-invites? If so, does it also have analytics?

    解决方案

    Great questions. I'll do my best to answer everything. Please ask if you need clarification.

    Analytics tracking requires a tracking Id that you'll need to set using setGoogleAnalyticsTrackingId(String trackingId), which I don't see in your example. This tracking Id is then handed to the downstream events that record analytics tracking events for you:

    • When invitations are send (both email and sms).
    • When the invited user accepts the invitation by clicking on the invitation link or button.
    • When the developer calls getInvitation()
    • When the developer calls convertInvitation()

    So, to answer your specific questions, here goes:

    1. Just add your tracking ID to the builder as described above, and all the tracking events will be reported. No need for a deeplink, that's optional on invites.
    2. Yes, appinvites api is copied to firebase while retaining the original. For now they are exactly the same. Future improvements will be in firebase, so migrate when you have time.
    3. getInvitationIntent() is called on the result returned in the callback from getInvitation(), so the callback should be within an activity. Also, since you'll only expect an invitation immediately after launch, you really only need to check in the main activity and any activity that would be launched from intent filters that trigger on the deeplink. Sounds like you don't use deeplinks, so only the main activity. Generally you should call getInvitation() from all activities that may be directly launched from an invitation, this is how you determine if your app is launched from an invitation.
    4. Yes, invites can go cross-platform in both directions, iOS -> android, and android -> iOS. You need to define both apps in the same project in console.developers.google.com, which is necessary to associate them. If there is more than one iOS app in the project, that api call is necessary to disambiguate the iOS app that is paired with the android app. The ClientID parameter is generated in the console when you create the OAuth Client Id using the pulldown menu from credentials section.
    5. There isn't any separate G+ invites.

    这篇关于如何正确使用和跟踪应用程序邀请?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆