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:
- Specify an identity link (using the new constructor for Android) with the name *language*:
- The identity link can be overridden by supplying a language property as part of any event.
View Home
Event Data:
1 | {} |
View Listing
Event Data:
1 2 3 | { "product": ["1","2"] } |
Objective-C Examples:
1 2 3 4 5 6 7 8 9 10 | - (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]]]; } |
1 2 3 4 5 6 7 8 9 10 | - (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:
1 2 3 4 5 6 7 8 9 10 11 | 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:
1 2 3 | { "product": "1" } |
Objective-C Examples:
1 2 3 4 5 6 7 8 9 10 | - (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]]]; } |
1 2 3 4 5 6 7 8 9 10 11 | - (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:
1 2 3 4 5 6 7 8 | JSONObject obj = new JSONObject(); try { obj.put("product", "1"); kTracker.event("viewProduct", obj.toString()); } catch (JSONException e) { e.printStackTrace(); } |
View Basket
Event Data:
1 2 3 4 5 6 7 | { "currency": "USD", "product":[ {"id":"1","price":2.95,"quantity":5}, {"id":"2","price":19.99,"quantity":1} ] } |
Objective-C Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - (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]]]; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - (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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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:
1 2 3 4 5 6 7 8 9 10 | { "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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - (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]]]; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - (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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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:
1 2 3 | { "ui_level": 100 } |
Java/Android Example:
1 2 3 4 5 6 7 8 | JSONObject uiLevel = new JSONObject(); try { uiLevel.put("ui_level", 100); kTracker.event("userLevel", uiLevel.toString()); } catch (JSONException e) { e.printStackTrace(); } |
User Status
Event Data:
1 2 3 | { "ui_status": "doingsupergood" } |
Achievement Unlocked
Event Data:
1 2 3 | { "ui_achievement":"won" } |
Java/Android Example:
1 2 3 4 5 6 7 8 | JSONObject achievementUnlocked = new JSONObject(); try { achievementUnlocked.put("ui_achievement", 100); kTracker.event("achievementUnlocked", achievementUnlocked.toString()); } catch (JSONException e) { e.printStackTrace(); } |
Date Range
Event Data:
1 2 3 4 5 6 7 8 9 10 11 12 | { "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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 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(); } |