Xamarin – Using the SDK


The following document describes the common use cases for the Kochava SDK after integration is complete. For information on integrating the SDK or configuring and starting the Tracker, refer to our Xamarin SDK Integration support documentation.


 

Standard Events:

 

Example (Standard Event with Standard Parameters)

 

Example (Standard Event with Standard and Custom Parameters)

 

If you wish to use a custom event type with standard parameters, use a custom event name string within your event constructor in place of a standard event type.

 

For a detailed list of standard event types and parameters, see: Post Install Event Examples


Custom Events:

 

Example (Custom Event with Custom Parameters)

 

Example (Send a Custom Event with Only a Name, no Event Data)

 

Example (Send a Custom Event with Event Data)

 

Example (Send a Custom Event with Serialized JSON Data)

 

 


 

Example (Standard Purchase Event):

 

Example (Custom Purchase Event with Serialized JSON Data):

 

Example (Custom Subscription Purchase Event with Serialized JSON Data)


In order to effectively track user subscriptions and free trials, an event should be instrumented at the time of the subscription purchase or start of the free trial along with an accompanying identity link.

When a subscription or free trial begins, first set an identity link for this subscriber and then instrument a standard Subscription or Trial event populated with the following values:

  • Price
  • Currency
  • Product Name
  • User or Subscriber ID (hash suggested)
  • Receipt (if available)

 

BEST PRACTICES: Always set the identity link before sending the event, otherwise the identity link will not be properly associated with the event.

 

Example (Identity Link with Subscription):

 

A free trial is handled in a similar way, although the price should be set to 0 and the event type should indicate Trial rather than Subscription. The product name should remain the same, as the event type indicates whether this was free trial or subscription.

Example (Identity Link with Free Trial):

 


 

Example (Standard Deeplink Event):

 

Example (Custom Deeplink Event with Serialized JSON Data):


 

Example (Acquire the Deeplink)

 

 

Example (Wait for the Callback)

 

 

Example (Set an Identity Link During Tracker Configuration):

 

Example (Set an Identity Link After Starting the Tracker):


 

Example (Requesting Attribution Results):

 

Example (Using the Getter After Attribution Results Have Been Retrieved):

 

The attribution results are provided as a stringified JSON object and can be parsed using a JSONObject or other JSON parsing functionality. If the attribution results have not yet been retrieved, calling the attribution data getter will return an empty string.

 


 

Example (Getting the Kochava Device ID):

 


Estimated Time to Complete
1 Minute

If at any time you’d like to get the current version of the SDK, call the SDK Version string getter. This will return the full string value of the SDK version, such as “AndroidTracker 3.4.2”.

 

Example (Getting the SDK Version String)


 

Example (Enabling App Limit Ad Tracking During Tracker Configuration):

 

Example (Enable App Limit Ad Tracking After Starting the Tracker):


 

To enable logging, set the desired log level during tracker configuration. When the tracker runs, each log message will be printed to your console log. In this example we’re setting a higher log level only when a debug build is detected, which is suggested but is not required.

 

Example (Enabling trace logging in a non-production build):

 


 

Example (Enabling Sleep Mode During Tracker Configuration):

 

Example (Enabling Sleep Mode After Starting the Tracker):

 

 

Example (Waking the Tracker from Sleep Mode)

 


 

Intelligent Consent Manager:

As GDPR can present many challenges during development, Free App Analytics offers a fully managed solution for all your GDPR consent requirements through the use of our Intelligent Consent Manager feature. By using this feature the Kochava SDK will handle determining when consent is required for any user while shouldering much the GDPR burden for you. For more information on this feature, see: Intelligent Consent Manager.

 

Self Managed Consent:

 

Example (Starting the Tracker Only When Consent Allows)

 

Example (Calling Tracker Methods Only When Consent Allows)


Estimated Time to Complete
1 Day

As GDPR can present many challenges during development, Free App Analytics offers a fully managed solution for all your GDPR consent requirements through the use of our Intelligent Consent Manager feature. By using this feature the Kochava SDK will handle determining when consent is required for any user while shouldering much the GDPR burden for you. For complete details on how this feature works, see: Intelligent Consent Manager.


  1. Use an alternate testing App GUID so that your testing activities do not have an impact on your live app analytics.
  2. Enable Logging, if helpful, to gain insight into the SDK’s behavior during runtime.
  3. If you would like the SDK to behave as it would during a new install, be sure to un-install the app before each test.
  4. Test your Free App Analytics integration. For more information see: Testing the Integration.

 

Analyzing SDK Behavior:


 
 

Last Modified: Jun 25, 2020 at 9:22 am