From 74912211b6933113afac25a4bbbb22c4cc26569a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20Ainsworth?= Date: Tue, 30 Jan 2024 15:54:01 +0100 Subject: [PATCH] Add event logging information Android --- .../docs/en/sdk/android/features/events.mdx | 155 +++++++++++++++--- 1 file changed, 130 insertions(+), 25 deletions(-) diff --git a/src/content/docs/en/sdk/android/features/events.mdx b/src/content/docs/en/sdk/android/features/events.mdx index f34a294eee..bb41968867 100644 --- a/src/content/docs/en/sdk/android/features/events.mdx +++ b/src/content/docs/en/sdk/android/features/events.mdx @@ -4,29 +4,29 @@ description: Use these methods to send event information to Adjust. slug: en/sdk/android/features/events --- -import TrackEvent from "@android-examples/Adjust/trackEvent.mdx" -import TrackEventSig from "@android-signatures/Adjust/trackEvent.mdx" -import TrackEventExample from "@android-examples/Adjust/trackEventExample.mdx" -import SetRevenue from "@android-examples/ADJEvent/setRevenue.mdx" -import SetRevenueSig from "@android-signatures/ADJEvent/setRevenue.mdx" -import SetRevenueExample from "@android-examples/ADJEvent/setRevenueExample.mdx" -import SetOrderId from "@android-examples/ADJEvent/setOrderId.mdx" -import SetOrderIdSig from "@android-signatures/ADJEvent/setOrderId.mdx" -import SetOrderIdExample from "@android-examples/ADJEvent/setOrderIdExample.mdx" -import SetCallbackId from "@android-examples/ADJEvent/setCallbackId.mdx" -import SetCallbackIdSig from "@android-signatures/ADJEvent/setCallbackId.mdx" -import SetCallbackIdExample from "@android-examples/ADJEvent/setCallbackIdExample.mdx" -import AddCallbackParameter from "@android-examples/ADJEvent/addCallbackParameter.mdx" -import AddCallbackParameterSig from "@android-signatures/ADJEvent/addCallbackParameter.mdx" -import AddCallbackParameterExample from "@android-examples/ADJEvent/addCallbackParameterExample.mdx" -import AddPartnerParameter from "@android-examples/ADJEvent/addPartnerParameter.mdx" -import AddPartnerParameterSig from "@android-signatures/ADJEvent/addPartnerParameter.mdx" -import AddPartnerParameterExample from "@android-examples/ADJEvent/addPartnerParameterExample.mdx" +import TrackEvent from "@android-examples/Adjust/trackEvent.mdx"; +import TrackEventSig from "@android-signatures/Adjust/trackEvent.mdx"; +import TrackEventExample from "@android-examples/Adjust/trackEventExample.mdx"; +import SetRevenue from "@android-examples/ADJEvent/setRevenue.mdx"; +import SetRevenueSig from "@android-signatures/ADJEvent/setRevenue.mdx"; +import SetRevenueExample from "@android-examples/ADJEvent/setRevenueExample.mdx"; +import SetOrderId from "@android-examples/ADJEvent/setOrderId.mdx"; +import SetOrderIdSig from "@android-signatures/ADJEvent/setOrderId.mdx"; +import SetOrderIdExample from "@android-examples/ADJEvent/setOrderIdExample.mdx"; +import SetCallbackId from "@android-examples/ADJEvent/setCallbackId.mdx"; +import SetCallbackIdSig from "@android-signatures/ADJEvent/setCallbackId.mdx"; +import SetCallbackIdExample from "@android-examples/ADJEvent/setCallbackIdExample.mdx"; +import AddCallbackParameter from "@android-examples/ADJEvent/addCallbackParameter.mdx"; +import AddCallbackParameterSig from "@android-signatures/ADJEvent/addCallbackParameter.mdx"; +import AddCallbackParameterExample from "@android-examples/ADJEvent/addCallbackParameterExample.mdx"; +import AddPartnerParameter from "@android-examples/ADJEvent/addPartnerParameter.mdx"; +import AddPartnerParameterSig from "@android-signatures/ADJEvent/addPartnerParameter.mdx"; +import AddPartnerParameterExample from "@android-examples/ADJEvent/addPartnerParameterExample.mdx"; You can associate your [Adjust event tokens](https://help.adjust.com/en/article/add-events#add-event) to actions in your app to record them. To record an event: -* Create a new Adjust event instance and pass your event token as a string argument. -* Call the `trackEvent` method || with your event instance as an argument. +- Create a new Adjust event instance and pass your event token as a string argument. +- Call the `trackEvent` method || with your event instance as an argument. @@ -34,6 +34,55 @@ This example demonstrates how to record an event with the token `g3mfiw` wheneve +```txt collapse={6-46} title="Event log" +Path: /event +ClientSdk: android4.38.0 +Parameters: + android_uuid 781f17d5-5048-4fae-a4e5-77b58bab62b9 + api_level 34 + app_token 2fm9gkqubvpc + app_version 1.0 + attribution_deeplink 1 + callback_params {"key":"value","foo":"bar"} + connectivity_type 1 + country US + cpu_type arm64-v8a + created_at 2024-01-25T14:13:16.151Z+0100 + currency EUR + device_manufacturer Google + device_name sdk_gphone64_arm64 + device_type phone + display_height 2205 + display_width 1080 + environment sandbox + event_buffering_enabled 0 + event_count 3 + event_token g3mfiw + gps_adid 5962dfc1-3a53-4692-850b-22c4bf4311a5 + gps_adid_attempt 2 + gps_adid_src service + hardware_name UE1A.230829.036 + language en + mcc 310 + mnc 260 + needs_response_details 1 + os_build UE1A.230829.036 + os_name android + os_version 14 + package_name com.adjust.examples + partner_params {"key":"value","foo":"bar"} + revenue 0.25 + screen_density high + screen_format long + screen_size normal + session_count 2 + session_length 23 + subsession_count 1 + time_spent 23 + tracking_enabled 1 + ui_mode 1 +``` + ## Record event revenue You can record revenue associated with an event by setting the revenue and currency properties on your event instance. Use this feature to record revenue-generating actions in your app. @@ -60,6 +109,17 @@ This example demonstrates how to record an event with the token `g3mfiw` wheneve +```txt title="Event log" {7,8} +Path: /event +ClientSdk: android4.38.0 +Parameters: + environment sandbox + event_count 3 + event_token abc123 + revenue 0.25 + currency EUR +``` + ## Unique events You can pass an optional identifier to avoid recording duplicate events. The SDK stores the last ten identifiers and skips revenue events with duplicate transaction IDs. @@ -74,6 +134,16 @@ This example demonstrates how to record an event with the token `g3mfiw` wheneve +```txt title="Event log" {7} +Path: /event +ClientSdk: android4.38.0 +Parameters: + environment sandbox + event_count 3 + event_token abc123 + order_id 5e85484b-1ebc-4141-aab7-25b869e54c49 +``` + ## Add callback parameters If you [register a callback URL](https://help.adjust.com/en/article/set-up-callbacks) in the Adjust dashboard, the SDK sends a GET request to your callback URL when it records an event. @@ -110,16 +180,29 @@ You can read more about using URL callbacks, including a full list of available This example demonstrates how to record an event with the token `g3mfiw` whenever a user interacts with a button. The following callback parameters are added: -* The `event_token` -* The `revenue_amount` generated by the event +- The `event_token` +- The `revenue_amount` generated by the event The resulting callback URL looks like this: ```http "event_token=g3mfiw" "revenue_amount=0.05" http://www.mydomain.com/callback?event_token=g3mfiw&revenue_amount=0.05 ``` + +You can check the parameters were sent to Adjust by checking for `callback_params` in your logs. + +```txt {4} title="Event log" +Path: /event +ClientSdk: android4.38.0 +Parameters: + callback_params {"event_token":"g3mfiw","revenue_amount":"0.05"} + environment sandbox + event_count 1 + event_token g3mfiw +``` + ## Add partner parameters You can send extra information to your network partners by adding [partner parameters](https://help.adjust.com/en/article/data-sharing-ad-network#map-parameters). @@ -140,11 +223,23 @@ Add partner parameters to your event by calling the `addPartnerParamete This example demonstrates how to record an event with the token `g3mfiw` whenever a user interacts with a button. The following partner parameters are added: -* The `product_id` of the associated product -* The `user_id` of the user who triggered the event +- The `product_id` of the associated product +- The `user_id` of the user who triggered the event +You can check the parameters were sent to Adjust by checking for `partner_params` in your logs. + +```txt title="Event log" {4} +Path: /event +ClientSdk: android4.38.0 +Parameters: + partner_params {"product_id":"29","user_id":"835"} + environment sandbox + event_count 1 + event_token g3mfiw +``` + ## Add a callback identifier You can add a custom string identifier to each event you want to measure. Adjust's servers can report on this identifier in event callbacks. This enables you to keep track of which events have been successfully measured. @@ -155,6 +250,16 @@ Set up this identifier by calling the `setCallbackId` method || + +```txt title="Event log" {7} +Path: /event +ClientSdk: android4.38.0 +Parameters: + environment sandbox + event_count 3 + event_token g3mfiw + callback_id f2e728d8-271b-49ab-80ea-27830a215147 +```