1. Home
  2. Integrations
  3. Android Unity Events Setup Guide
  4. Content Based Application – Android Unity

Content Based Application – Android Unity

We have provided a list of Events with their example usage that can be integrated for Content based Applications. Please find them below:

 

1. Purchase Event

This is used to track the successful Purchase events or paid subscription to the Application.

You will need to call the below method to track the In-App Purchase event in your Application.

Java

public static void TrackPurchase
(string userID, float revenue, PaymentMode paymentMode,
string transactionID, FrequencyMode frequencyMode,
string languageCode, string countryCode, Dictionary
<string, Dictionary<string, object>>
purchaseProductList, Dictionary<string, object> extraParamsDic);

 

// Product List Array Definition

Dictionary<string, Dictionary<string, object>>
productList = new Dictionary<string, Dictionary<string, object>> ();

 

// Product Array Definition

HTML

Dictionary<string, object> product1 = new Dictionary<string, object> ();

 

  • Mandatory parameters (Product):                                           
    • Product Identifier  – Unique Product Identifier
    • Product Name  – Name of the Product
    • Price  – Price of the Product
    • Price  – Price of the Product
    • Quantity  -Quantity of the Product being Purchased
  • Optional parameters (Product):                                          
    • Brand  – Brand Name of the Product
    • Product Discount  – Discount applied for the Product
    • Category  – Product Category

// How to create Product List Array

Dictionary<string, Dictionary<string, object>> productList = new Dictionary<string, Dictionary<string, object>> ();
Dictionary<string, object> product1 = new Dictionary<string, object> ();
Dictionary<string, object> product2 = new Dictionary<string, object> ();

 

// Adding the items to the Product List

productList.Add ((EventConstant.PRODUCT_ITEM + “1”), product1);
productList.Add ((EventConstant.PRODUCT_ITEM + “2”), product2);

 

Note : Add items to the list by concatenation of incremental value with PRODUCT_ITEM constant as shown in above example.

  • Mandatory parameters (Purchase):                                           
    • User Id  – Unique User Identifier
    • Revenue  -Total Revenue generated from this Purchase event
    • Payment Mode  – CREDIT_CARD or DEBIT_CARD or NET_BANKING or GIFT_CARD or EMI or COD or PAYMENT_WALLET
    • Transaction Id –  Unique Purchase Transaction Identifier
    • Purchase Frequency ONCE or RECURRING representing One Time Payment or Subscription based Payment respectively
    • Product List (productItemList) – Array of the list of products purchased.
    • Language Code – Unique Language Code.
    • Country Code – Unique country code Note: For passing custom language Code currency code. Please Click here to view list of country codes.
    • (ISO-3166) & Language codes (ISO-639).   Follow the sample below.   
    • Example : Locale *languageCode = ”JP” Locale *currencyCode = ”JP”
  • Optional parameters (Purchase):                                          
    • Loyalty  – Loyalty points applied on the Purchase
    • Overall Discount – Discount applied for the Purchase
    • Service Charge – Service Charge applied for the Purchase
    • Location  – Geolocation of the Event   

Sample Code

Dictionary<string, Dictionary<string, object>> productList = new Dictionary<string, Dictionary<string, object>> ();

       Dictionary<string, object> product1 = new Dictionary<string, object> ();
       product1.Add (EventConstant.IDENTIFIER, “1000123”);
       product1.Add (EventConstant.PRODUCT_NAME, “Targus Backpack”);
       product1.Add (EventConstant.PRICE, 29.99);
       product1.Add (EventConstant.QUANTITY, 1);
       product1.Add (EventConstant.BRAND, “Targus”); // Optional parameter
       product1.Add (EventConstant.PRODUCT_DISCOUNT, 5.00); // Optional parameter
       product1.Add (EventConstant.CATEGORY, “Bags”); // Optional parameter

       productList.Add ((EventConstant.PRODUCT_ITEM + “1”), product1);

Dictionary<string, object> extrasParams = new Dictionary<string, object> ();        
       extrasParams.Add (EventConstant.LOYALTY, 65.00);
       extrasParams.Add (EventConstant.OVER_ALL_DISCOUNT, 5.00);    
       extrasParams.Add (EventConstant.SERVICE_CHARGE, 4.99);
       extrasParams.Add (EventConstant.PAGE_NAME, “Purchase_summary”);
       extrasParams.Add (EventConstant.LATITUDE, 34.147785);
       extrasParams.Add (EventConstant.LONGITUDE, -118.144516);

       MTractionTracker.TrackPurchase (“123”, 9.99f, PaymentMode.CREDIT_CARD, “123”, FrequencyMode.ONCE, “JP”, “JP”, productList, extrasParams);

2. Content Viewed Event

This is used to track the event triggered when the user has viewed any content on the Application.

You will need to call the below method to track the Content viewed event in your Application Class to track the Content viewed event in your Application.

Java

public static void TrackContentViewed
(string userID, float revenue, string identifier, MediaType mediaType,
string languageCode, string countryCode, Dictionary
<string, object> extraParamsDic);

 

  • Mandatory parameters (Content Viewed):                                            
    • User Id – Unique User Identifier
    • Revenue – Total Revenue generated from this Content Viewed event
    • Identifier – Unique Content Identifier
    • Media Type  -Type of content viewed, AUDIO or VIDEO or TEXT or IMAGE
    • Language Code – Unique Language Code.
    • Country Code – Unique Country Code.
    • Note: For passing custom language Code currency code,Click here to view the list of Country codes
    • (ISO-3166) & Language codes (ISO-639).   Follow the sample below.   
    • Example : Locale *languageCode = ”JP” Locale *currencyCode = ”JP”           
  • Optional parameters (Content Viewed):                                            
    • Product Name – Title of the Content
    • Category – Content Category
    • Page Name – Page that triggered the Event
    • Location – Geolocation of the Event

Sample Code

Dictionary<string, object> extrasParams = new Dictionary<string, object> ();        
       extrasParams.Add (EventConstant.PRODUCT_NAME, “Article on Electronic gadgets”);
       extrasParams.Add (EventConstant.CATEGORY, “Technology”);
       extrasParams.Add (EventConstant.PAGE_NAME, “Article”);
       extrasParams.Add (EventConstant.LATITUDE, 34.147785);
       extrasParams.Add (EventConstant.LONGITUDE, -118.144516);

       MTractionTracker.TrackContentViewed (“123”, 123.00f, “12345”, MediaType.AUDIO, “JP”, “JP”, extrasParams);

3.Create Playlist Event

This is used to track the event triggered when a user has to create playlist in your Application.

You will need to call the below method to track the Create playlist event in your Application.

trackCreatePlaylist: function(playList,description,identifier,pageName,latitude,longitude)

 

  • Mandatory parameters (Create playlist):                                                                     
    • Playlist Name – User Playlist Name
    • Identifier  – Unique Event Identifier
  • Optional parameters (Create playlist):                                                                    
    • Description – Additional information about the shared item
    • Page Name – Page that triggered the Event
    • Location – Geolocation of the Event

Sample Code

Js

<script>
      function trackCreatePlaylist(){
mtractiontracker.trackCreatePlaylist(“MyFavList”,“Songs List”,“12345”,“Playlist”,35.01,70.01);
      }
  </script>

 

Was this article helpful to you? Yes No

How can we help?