Personalizar invitaciones en la aplicación usando AppsFlyer

Todos los que han creado la interacción del usuario con la aplicación saben lo difícil que es. Uno de los mecanismos de esta interacción es Deep Linking. Las notificaciones push, la adquisición y retención de usuarios dependen de su trabajo.





AppsFlyer , .





SDK

AppsFlyer — . .





SDK — .





, . onConversionDataSuccess



.





override fun onConversionDataSuccess(map: MutableMap<String, Any>?) {
	Timber.d("Attribution - ${map ?: "empty"}")
  if (map.isNullOrEmpty()) {
  	return
  }
  //handle attribution here
      
      



. , .





«Attribution – empty». :





  1. AppsFlyer.





  2. AppsFlyer, , debug .





  3. .





, AppsFlyer , ( debbuger):





Ejemplo de atribución después de la instalación

map. , , http_referrer , , is_first_launch . 





af_dp — , id — hSPRMKbU8. id, — .





, , .





  1. . , . , , — . , .





  2. , , , . 2 15 . UI, , — . , , . 





, , ! .





, . , . , - , — . 





AppsFlyer API , . , , SDK . — LinkGenerator.





with(generator) {
  setReferrerName("user nick")
  setReferrerUID("user unique id")
  setReferrerImageURL("user avatar url")
  addParameter("is_retargeting", true.toString())
  addParameter("af_dp", "link for content in application")
  addParameter("af_web_dp", "additional link for web page")
  generateLink(context, listener)
}
      
      



, Google Play , , .





, . — , . , .





-, intent-filter.





<intent-filter anroid:autoVerify="true">
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:scheme="https"
        android:host="${oneLinkAppHost}"
        android:prefix="/${oneLinkPathPrefix}" />
</intent-filter>
      
      



-, onAppOpenAttribution. , .





override fun onAppOpenAttribution(map: MutableMap<String, String>?) {
  if (map.isNullOrEmpty()) {
    return
  }
  val data = AppsFlyerConversionAttrs.init(map as Map<String, Any>)
  if (!TextUtils.isEmpty(data.afDeeplink)) {
    handleDeeplink(data.afDeeplink)
  }
}
      
      



, , onConversionDataSuccess . 





. : -, . . 





, :





  1. -.





  2. - .





. , -, . , : id, .





private val inviteLinkPlaceholder = "Click this link to add %1$s as friend"

private val listener = object : CreateOneLinkHttpTask.ResponseListener {
  override fun onResponse(inviteLink: String?) {
    if (!TextUtils.isEmpty(inviteLink)) {
      generatedLinkSubject.onNext(String.format(inviteLinkPlaceholder, 
                                                authSessionManager.authSession.nick,
                                                inviteLink))
    } else {
      generatedLinkSubject.onNext("")
    }
  }
  
  override fun onResponseError(p0: String?) {
    generatedLinkSubject.onNext(p0 ?: "")
  }
}

fun generate(content: Content): Observable<String> {
    generatedLinkSubject = PublishSubject.create()
  with(generator) {
    setReferrerName(authSessionManager.authSession.nick)
    setReferrerUID(authSessionManager.authSession.uid)
    setReferrerImageURL(authSessionManager.authSession.photoUrl)
    addParameter("is_retargeting", true.toString())
    addParameter("af_dp", content.link)
    addParameter("af_web_dp", content.webLink)
    generateLink(context, listener)
  }
  return generatedLinkSubject
}
      
      



: Click this link to add Rick_Rick as friend in ABPV https://abpv.onelink.me/nWMv/344e6258, .





, , , , .





.





onConversionDataSuccess -. media_source, af_app_invites.





if (data.afMediaSource == "af_app_invites") {
    //handle data from invite link
  onInstallationAttributionSubject.onNext(ACTION_PERFORMED)
}
      
      



onInstallationAttributionSubject, subject.





Pantalla de invitación final

 

, , .





, - .





, AppsFlyer , , , .








All Articles