AppsFlyer 研究(二)应用内事件

一、记录应用内事件

 

应用内事件可助您深入了解应用里正在发生的事。我们建议您花些时间定义要记录的事件。记录应用内事件有助于您衡量KPI,例如ROI(投资回报率)和LTV(生命周期价值)。

有几种方法可以记录应用内事件。最常见的方法是通过我们在本文中讨论的通过SDK发送事件。

 

如果您的应用属于某个行业,例如旅行、游戏、电子商务等,您可以参考每个行业的推荐应用内事件列表。

 

1、应用内事件类型

以下部分介绍了每个事件类型的推荐结构, 以及指向 Facebook、Twitter、Criteo、Google Ads 和 Snapchat 的参数映射。

 

以下应用内事件被定义为 AFInAppEventType 接口的一部分, 建议这样做:

 

完成注册

事件名称:af_complete_registration

描述:用于追踪用户注册方式

事件参数 (Android): AFInAppEventType.COMPLETE_REGISTRATION

事件参数 (iOS):AFEventCompleteRegistration

Facebook映射事件: fb_mobile_complete_registration

Twitter映射事件: SIGN_UP

Criteo映射事件:无

Google Ads: sign_up

Snapchat: SIGN_UP

推荐参数: af_registration_method

属性映射:

AppsFlyer Facebook Twitter Criteo Google Ads Snapchat
af_registration_ method fb_registration_ method registration_method - registration_method sign_up_method

 

 

购买

事件名称: af_purchase

描述:用于追踪购买事件(及相关收入)

事件参数 (Android): AFInAppEventType.PURCHASE

事件参数 (iOS): AFEventPurchase

Facebook映射事件: fb_mobile_purchase

Twitter映射事件: PURCHASE

Criteo 映射事件: transactionConfirmation

Google Ads: in_app_purchase

Snapchat: PURCHASE

推荐参数: af_revenue, af_content_type, af_content_id, af_content, af_price, af_quantity, af_currency, af_order_id

属性映射:

AppsFlyer Facebook Twitter Criteo Google Ads Snapchat Partnerize
af_revenue* _valueToSum price_micro** ui_revenue value price -
af_content_type fb_content_type content_type - item_category item_category 类别
af_content_id fb_content_id content_id id item_id item_ids -
af_content fb_content - - - - Custom conversion meta
af_currency fb_currency price_currency currency currency_code currency currency
af_quantity fb_num_items number_items quantity quantity number_items quantity
af_validated - - - 已验证 success Voucher
af_receipt_id - - transaction_id transaction_id - Conversion Reference
af_order_id fb_order_id - - order_id transaction_id Clickref
af_content_list fb_content_id - - item_id - Custom item meta
af_date_a fb_checkin_date - din start_date - -
af_date_b fb_checkout_date - dout end_date - -
af_departing_ departure_date fb_departing_ departure_date - - - - -
af_returning_ departure_date fb_returning_ departure_date - - - - -
af_destination_a fb_origin_airport - - origin - -
af_destination_b fb_destination_ airport - - destination - -
af_destination_list fb_destination_ids - - - - -
af_city fb_city - - - - -
af_region fb_region -- -- -- -- -
af_country fb_country - - - - -
af_departing_arrival_ date fb_departing_arrival_ date - - - - -
af_returning_arrival_ date fb_returning_arrival_ date - - - - -
af_suggested_ destinations fb_suggested_ destinations - - - - -
af_travel_start fb_travel_start - - - - -
af_travel_end fb_travel_end - - - - -
af_num_adults fb_num_adults - - - - -
af_num_children fb_num_children - - - - -
af_num_infants fb_num_infants - - - - -
af_class fb_travel_class - - travel_class - -
af_suggested_ hotels fb_suggested_ hotels - - - - -
af_user_score fb_user_score - - - - -
af_hotel_score fb_hotel_score - - - - -
af_price fb_purchase_value - price** price - value
af_purchase_ currency fb_purchase_ currency - - - - -
af_preferred_star_ ratings fb_preferred_star_ ratings - - - - -
af_preferred_price_ range fb_preferred_price_ range - - - - -
af_preferred_ neighborhoods fb_preferred_ neighborhoods - - - - -
af_preferred_num_ stops fb_preferred_num_ stops - - - - -

* af_revenue 用于计算 AppsFlyer 平台中的收入。

**af_price - 您可使用 af_price 作为不计算收入的货币参数(例如“添加到购物车”事件)。 该参数意指单个商品价格。 所有购买的总金额用 af_revenue 参数表示。

 

广告点击

事件名称: af_ad_click

说明: 用于追踪应用中展示广告的点击次数

事件参数 (Android): AFInAppEventType.AD_CLICK

事件参数 (iOS): AFEventAdClick

Facebook 映射时间: AdClick

Twitter映射事件: 无

Criteo映射事件:无

Google Ads: 无

推荐属性: af_adrev_ad_type

属性映射:

AppsFlyer Facebook Twitter Criteo Google Ads
af_adrev_ad_type ad_type - - -
af_currency fb_currency - - -

 

 

分享

事件名称: af_share

描述:用于追踪分享事件

事件参数 (Android): AFInAppEventType.SHARE

事件参数 (iOS): AFEventShare

Facebook 映射 事件: 无

Twitter 映射事件: SHARE

Criteo映射事件:无

Google Ads: share

推荐 属性: af_description

属性映射:

AppsFlyer Facebook Twitter Criteo Google Ads
af_description - description - description

 

 

邀请

事件名称: af_invite

描述:用于追踪邀请(社交)事件

事件参数 (Android): AFInAppEventType.INVITE

事件参数 (iOS): AFEventInvite

Facebook 映射事件: None

Twitter 映射事件: INVITE

Criteo映射事件:无

Google Ads: invite

推荐属性: 无

属性映射:

AppsFlyer Facebook Twitter Criteo Google Ads
af_description - description - description

登录

事件名称:af_login

描述:用于追踪用户登录事件

事件参数 (Android): AFInAppEventType.LOGIN

事件参数 (iOS): AFEventLogin

Facebook 映射事件: None

Twitter 映射事件: LOGIN

Criteo映射事件:无

Google Ads: login

推荐属性: 无

 

 

用户唤醒

事件名称: af_re_engage

描述: 用于追踪用户的重参与事件

事件参数 (Android): AFInAppEventType.RE_ENGAGE

事件参数 (iOS): AFEventReEngage

Facebook 映射 事件: 无

Twitter 映射事件: RE_ENGAGE

Criteo映射事件:无

Google Ads: custom_event

推荐 属性: 无

属性映射:

AppsFlyer Facebook Twitter Criteo Google Ads
af_description - description - description

 

 

从推送通知打开

事件名称: af_opened_from_push_notification

描述:用于追踪从推送通知打开应用的事件

事件参数 (Android): AFInAppEventType.OPENED_FROM_PUSH_NOTIFICATION

事件参数 (iOS): AFEventOpenedFromPushNotification

Facebook 映射事件: None

Twitter映射事件: 无

Criteo映射事件:无

Google Ads: notification_open

推荐 属性: 无

 

 

2、 应用内事件限制

  • 事件名称:最多45个字符

  • 事件值:不得超过1000个字符-如超过这个长度,我们可能会截断它

  • 定价和收入:仅使用数字和小数点,例如5或5.2

  • 价格和收入最多可以到小数点后5位,如5.12345

  • 从Android SDK V4.8.1开始,应用内事件和其他SDK API都支持非英语字符。

     

3、 记录应用内事件的示例

您可以通过调用trackEvent来记录应用内事件的名称和参数值。有关更多详细信息,请参见应用内事件文档。

以下是有关如何记录购买事件的简单示例。关于每个行业的现成代码片段列表,请参阅详细应用内事件指南

示例:应用内购买活动

Java

Map eventValues = new HashMap<>();
eventValues.put(AFInAppEventParameterName.REVENUE, 1200);
eventValues.put(AFInAppEventParameterName.CURRENCY, "JPY");
eventValues.put(AFInAppEventParameterName.CONTENT_TYPE, "Shoes");
AppsFlyerLib.getInstance().trackEvent(this, AFInAppEventType.PURCHASE, eventValues);

 

4、记录离线应用内事件

如果用户在互联网连接不可用时启动事件,Appsflyer仍然可以记录该事件。它是这样工作的:

  1. SDK 将事件发送到 AppsFlyer 的服务器并等待响应。

  2. 如果 SDK 没有收到响应200, 则该事件将存储在缓存中。

  3. 收到下一个响应200后, 存储的事件将重新发送到服务器。

  4. 如果缓存中有多个事件, 它们将被立即按序发送到服务器。

注意

SDK 的缓存最多可以存储40个事件, 这意味着只保存脱机发生的前40个事件。所有之后的事件都会被丢弃,直到下一个相应200。

原始数据中显示的事件时间是设备再次联机后事件发送到AppsFlyer的时间。不是事件发生的实际时间。

 

5、记录应用内事件处理成功和失败的信息

您可以在记录应用内事件时设置监听器。监听器可以给两种场景定义逻辑:

  • 应用内事件已成功记录。

  • 记录应用内事件时发生错误。

Java

AppsFlyerLib.getInstance().trackEvent(getApplicationContext(), AFInAppEventType.PURCHASE, eventValue, new AppsFlyerTrackingRequestListener() {
      @Override
      public void onTrackingRequestSuccess() {
        Log.d(AppsFlyerLibCore.LOG_TAG, "onTrackingRequestSuccess");
      }
      @Override
      public void onTrackingRequestFailure(String error) {
        Log.d(AppsFlyerLibCore.LOG_TAG, "onTrackingRequestFailure: " + error);
      }
 });

你可能感兴趣的:(AppsFlyer,Android,java,android)