Support Home > Campaign Management > Criteo Data Syndication – Event Setup

Criteo Data Syndication – Event Setup

In order to map a Kochava event to a Criteo event, there is a Criteo Event Type UI field. This will allow a Kochava event such as Purchase Bag to be sent to Criteo as trackTransaction. Each event type will also require a specific JSON object to be passed as part of an event call in the Kochava SDK.

NOTE: Within this document are the JSON structures required for specific Criteo events as well as Objective-C and Java examples, where applicable.


Constructors

In order to specify a language, proceed with one of the following:

  1. Specify an identity link (using the new constructor for Android) with the name *language*:
  2. The identity link can be overridden by supplying a language property as part of any event.

View Home

Event Data:

{}

View Listing

Event Data:

{
  "product": ["1","2"]
}

 

Objective-C Examples:

- (void) viewListingExample {

    NSMutableDictionary * viewListing = [[NSMutableDictionary alloc] init];
    [viewListing setObject:[NSArray arrayWithObjects:@"1", @"2", nil] forKey: @"product"];

    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:viewListing options:0 error:nil];

    [delegate.kochavaTracker trackEvent: @"viewListing": [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]]];

}

 

- (void) viewListingExample2 {

    NSDictionary * viewListing = @{
      @"product": @[@"1", @"2"]
    };
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:viewListing options:0 error:nil];

    [delegate.kochavaTracker trackEvent: @"viewListing": [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]]];

}

 

Java/Android Example:

JSONObject viewListing = new JSONObject();
JSONArray products = new JSONArray();
 
try {
    products.put("1");
    products.put("2");
    viewListing.put("product", products);
    kTracker.event("viewListing", viewListing.toString());
} catch (JSONException e) {
    e.printStackTrace();
}

View Product

Event Data:

{
  "product": "1"
}

 

Objective-C Examples:

- (void) viewProductExample {

    NSDictionary \* viewProduct = [[NSDictionary alloc] init];
    [viewProduct setValue:@"1" forKey: @"product"];

    NSData \*jsonData = [NSJSONSerialization dataWithJSONObject:viewProduct options:0 error:nil];

    [delegate.kochavaTracker trackEvent: @"viewProduct": [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]]];

}

 

- (void) viewProductExample2 {

    NSDictionary * viewProduct = @{
      @"product": @"1"
    };

    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:viewProduct options:0 error:nil];

    [delegate.kochavaTracker trackEvent: @"viewProduct": [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]]];

}

 

Java/Android Example:

JSONObject obj = new JSONObject();
 
try {
    obj.put("product", "1");
    kTracker.event("viewProduct", obj.toString());
} catch (JSONException e) {
    e.printStackTrace();
}

View Basket

Event Data:

{
  "currency": "USD",
  "product":[
    {"id":"1","price":2.95,"quantity":5},
    {"id":"2","price":19.99,"quantity":1}
  ]
}

 

Objective-C Examples:

- (void) viewBasketExample {

    NSDictionary * product1 = [[NSDictionary alloc] init];
    [product1 setValue:@"1" forKey:@"id"];
    [product1 setValue:@"2.95" forKey:@"price"];
    [product1 setValue:@"1" forKey:@"quantity"];

    NSDictionary * product2 = [[NSDictionary alloc] init];
    [product2 setValue:@"1" forKey:@"id"];
    [product2 setValue:@"2.95" forKey:@"price"];
    [product2 setValue:@"1" forKey:@"quantity"];

    NSDictionary * viewBasket = [[NSDictionary alloc] init];
    [viewBasket setValue:@"USD" forKey:@"currency"];
    [viewBasket setValue:[NSArray arrayWithObjects:product1, product2, nil] forKey:@"product"];

    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:viewBasket options:0 error:nil];

    [delegate.kochavaTracker trackEvent: @"viewBasket": [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]]];

}

 

- (void) viewBasketExample2 {

    NSDictionary * viewBasket = @{
      @"currency": @"USD",
      @"product": @[
        @{
          @"id": @"1",
          @"price": @"2.95",
          @"quantity": @"5"
        },
        @{
          @"id": @"2",
          @"price": @"19.99",
          @"quantity": @"1"
        }
      ]
    };

    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:viewBasket options:0 error:nil];

    [delegate.kochavaTracker trackEvent: @"viewBasket": [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]]];

}

 

Java/Android Example:

JSONObject viewBasket = new JSONObject();
JSONArray products = new JSONArray();
 
JSONObject product1 = new JSONObject();
JSONObject product2 = new JSONObject();
 
try {
 
    product1.put("id", 1);
    product1.put("price", 2.95);
    product1.put("quantity", 5);
 
    product2.put("id", 2);
    product2.put("price", 19.95);
    product2.put("quantity", 1);
 
    products.put(product1);
    products.put(product2);
 
 
    viewBasket.put("currency", "USD");
    viewBasket.put("product", products);
 
    kTracker.event("viewBasket", viewBasket.toString());
} catch (JSONException e) {
    e.printStackTrace();
}

View Transaction

Event Data:

{
  "dd":1,
  "nc":1,
  "id":"someid",
  "currency":"USD",
  "product":[
    {"id":"1","price":2.95,"quantity":5},
    {"id":"2","price":19.99,"quantity":1}
  ]
}

 

Objective-C Examples:

- (void) trackTransactionExample {

    NSDictionary * product1 = [[NSDictionary alloc] init];
    [product1 setValue:@"1" forKey:@"id"];
    [product1 setValue:@"2.95" forKey:@"price"];
    [product1 setValue:@"1" forKey:@"quantity"];

    NSDictionary * product2 = [[NSDictionary alloc] init];
    [product2 setValue:@"1" forKey:@"id"];
    [product2 setValue:@"2.95" forKey:@"price"];
    [product2 setValue:@"1" forKey:@"quantity"];

    NSDictionary * trackTransaction = [[NSDictionary alloc] init];
    [trackTransaction setValue:@"dd" forKey:@"1"];
    [trackTransaction setValue:@"nc" forKey:@"1"];
    [trackTransaction setValue:@"id" forKey:@"someid"];
    [trackTransaction setValue:@"USD" forKey:@"currency"];
    [trackTransaction setValue:[NSArray arrayWithObjects:product1, product2, nil] forKey:@"product"];

    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:trackTransaction options:0 error:nil];

    [delegate.kochavaTracker trackEvent: @"trackTransaction", [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]]];

}

 

- (void) viewBasketExample2 {

    NSDictionary * trackTransaction = @{
                                  @"dd": @"1",
                                  @"nc": @"1",
                                  @"id": @"someid",
                                  @"currency": @"USD",
                                  @"product": @[
                                          @{
                                              @"id": @"1",
                                              @"price": @"2.95",
                                              @"quantity": @"5"
                                              },
                                          @{
                                              @"id": @"2",
                                              @"price": @"19.99",
                                              @"quantity": @"1"
                                              }
                                          ]
                                  };

    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:trackTransaction options:0 error:nil];

    [delegate.kochavaTracker trackEvent: @"trackTransaction": [[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]]];
}

 

Java/Android Example:

JSONObject trackTransaction = new JSONObject();
JSONArray products = new JSONArray();
 
JSONObject product1 = new JSONObject();
JSONObject product2 = new JSONObject();
 
try {
 
    product1.put("id", 1);
    product1.put("price", 2.95);
    product1.put("quantity", 5);
 
    product2.put("id", 2);
    product2.put("price", 19.95);
    product2.put("quantity", 1);
 
    products.put(product1);
    products.put(product2);
 
    trackTransaction.put("dd", 1);
    trackTransaction.put("nc", 1);
    trackTransaction.put("id", "someid");
    trackTransaction.put("currency", "USD");
    trackTransaction.put("product", products);
 
    kTracker.event("trackTransaction", trackTransaction.toString());
} catch (JSONException e) {
    e.printStackTrace();
}

User Level

Event Data:

{
  "ui_level": 100
}

 

Java/Android Example:

JSONObject uiLevel = new JSONObject();
 
  try {
      uiLevel.put("ui_level", 100);
      kTracker.event("userLevel", uiLevel.toString());
  } catch (JSONException e) {
      e.printStackTrace();
  }

User Status

Event Data:

{
  "ui_status": "doingsupergood"
}

Achievement Unlocked

Event Data:

{
  "ui_achievement":"won"
}

 

Java/Android Example:

JSONObject achievementUnlocked = new JSONObject();
 
try {
    achievementUnlocked.put("ui_achievement", 100);
    kTracker.event("achievementUnlocked", achievementUnlocked.toString());
} catch (JSONException e) {
    e.printStackTrace();
}

Date Range

Event Data:

{
  "dd":1,
  "nc":1,
  "id":"someid",
  "currency":"USD",
  "product":[
    {"id":1,"price":2.95,"quantity":5},
    {"id":2,"price":19.99,"quantity":1}
  ],
  "din":"2015-04-07",
  "dout":"2015-04-10"
}

 

Java/Android Example:

JSONObject trackTransaction = new JSONObject();
JSONArray products = new JSONArray();
 
JSONObject product1 = new JSONObject();
JSONObject product2 = new JSONObject();
 
try {
 
    product1.put("id", 1);
    product1.put("price", 2.95);
    product1.put("quantity", 5);
 
    product2.put("id", 2);
    product2.put("price", 19.95);
    product2.put("quantity", 1);
 
    products.put(product1);
    products.put(product2);
 
    trackTransaction.put("dd", 1);
    trackTransaction.put("nc", 1);
    trackTransaction.put("id", "someid");
    trackTransaction.put("currency", "USD");
    trackTransaction.put("product", products);
    trackTransaction.put("din", "2015-04-07");
    trackTransaction.put("dout", "2015-04-010");
 
    kTracker.event("trackTransaction", trackTransaction.toString());
} catch (JSONException e) {
    e.printStackTrace();
}

 
 

Last Modified: Oct 11, 2023 at 9:33 am