Mobile SDK end-of-life has been announced and scheduled for the end of 2023, in favor of updated and more streamlined app personalization using server-side APIs.
Events are used for tracking meaningful user interactions (e.g. purchase, add to cart, form completion, rating a product) for the purpose of behavioral targeting, reporting, and recommendations. Sending event data to Dynamic Yield is done by implementing a short snippet. Some of the pre-defined events are required for certain features, but you can use any predefined or custom event to report information to Dynamic Yield.
Pre-Defined Dynamic Yield Events
The user has added a product to the cart.
Parameters
- name: Human-readable name, not used to identify an event type.
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “add-to-cart-v1″ | String |
value | Total value in actual payment currency | Float (dollars.cents). The number must be positive. Numbers are rounded to the nearest 0.01. Numbers smaller than 0.005 are rounded down to 0. |
currency | Optional non-default currency used | String |
productId | SKU exactly as it appears in the product feed | String |
quantity | Number | |
size | Optional string, customer specific values | String |
cart (optional but recommended) |
The absolute current cart state (including the last added item). Products should be in order from oldest to newest. Cart Properties: |
|
productId: SKU exactly as it appears in the product feed |
String |
|
quantity | Number | |
itemPrice | Number. Numbers are rounded to the nearest 0.01. Numbers smaller than 0.005 are rounded down to 0. | |
size: Optional | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:ITEM_VALUE forKey:@"value"];
[eventDictionary setObject:PRODUCT_ID forKey:@"productId"];
[eventDictionary setObject:QUANTITY forKey:@"quantity"];
[eventDictionary setObject:@"add-to-cart-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Add to Cart" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["productId"] = PRODUCT_ID
product["quantity"] = QUANTITY
product["value"] = ITEM_VALUE
product["dyType"] = "add-to-cart-v1"
//Sending the Event
DYApi.getInstance().trackEvent("add to cart", prop: product)
Java Example (Android)
//Populating the Prop parameter
JSONObject props = new JSONObject();
props.put( "value", ITEM_VALUE );
props.put( "productId", PRODUCT_ID );
props.put( "quantity", QUANTITY );
props.put( "dyType","add-to-cart-v1" );
//Sending the Event
DYApi.getInstance().trackEvent("Add to Cart", props );
JavaScript Example (React Native)
DYReact.trackEvent(
'Add to Cart',
{
dyType: "add-to-cart-v1",
value: 59.13,
currency: "any supported currency code",
productId: "item-34454",
quantity: 1,
size: "XL",
cart: [{
productId: "sku-4324-bg",
quantity: 2,
itemPrice: 12.34,
},
{
productId: "item-34454",
quantity: 1,
itemPrice: 34.45
}
]
}
);
The user has added a product to their Wishlist.
Parameters
- name: Human-readable name, not used to identify an event type.
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “add-to-wishlist-v1” | String |
productId | The product SKU | String |
size | optional string | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:PRODUCT_ID forKey:@"productId"];
[eventDictionary setObject:@"add-to-wishlist-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"add to wishlist" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["productId"] = PRODUCT_ID
product["dyType"] = "add-to-wishlist-v1"
//Sending the Event
DYApi.getInstance().trackEvent("add to wishlist", prop: product)
Java Example (Android)
//Populating the Prop parameter
JSONObject props = new JSONObject();
props.put( "productId", PRODUCT_ID );
props.put( "dyType","add-to-wishlist-v1" );
//Sending the Event
DYApi.getInstance().trackEvent("add to wishlist", props );
JavaScript Example (React Native)
DYReact.trackEvent(
"Add to Wishlist",
{
dyType: "add-to-wishlist-v1",
productId: "item-34454",
size: "XL"
}
);
The user has changed an attribute of the displayed product (e.g. color, fit).
Parameters
- name: Human-readable name, not used to identify an event type.
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “change-attr-v1” | String |
attributeType | Color, Size, Brand, Fit, Author, Keyword, Category… | String |
attributeValue | The new value | String |
Note: the attribute type and value should match the product feed. The currently displayed product is inferred from the in-page context.
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:@"Color" forKey:@"attributeType"]; // Name of attribute (Color, Size, Brand, Fit, Author, Keyword, Category...)
[eventDictionary setObject:VALUE forKey:@"attributeValue"]; // Either a string value OR a numeric value. This affects how segmentation conditions are run.
[eventDictionary setObject:@"change-attr-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Change Attribute" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["attributeType"] = "Color"; // Any of: Color, Size, Brand, Fit, Author, Keyword, Category...
product["attributeValue"] = VALUE;
product["dyType"] = "change-attr-v1"
//Sending the Event
DYApi.getInstance().trackEvent("Change Attribute", prop: product)
Java Example (Android)
//Populating the Prop parameter
JSONObject props = new JSONObject();
props.put( "attributeType", "Color" ); // Any of: Color, AGE, POPULARITY, RATING, OTHER
props.put( "attributeValue", VALUE );
props.put( "dyType","change-attr-v1" );
//Sending the Event
DYApi.getInstance().trackEvent("Change Attribute", props );
JavaScript Example (React Native)
DYReact.trackEvent(
"Change Attribute",
{
dyType: "change-attr-v1",
attributeType: "Color",
attributeValue: "Navy Blue"
}
);
The user has filtered the product list by a specific field value.
Parameters
- name: Human-readable name, not used to identify an event type.
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “filter-items-v1” | String |
filterType | Name of filter (Color, Size, Brand, Fit, Author, Keyword, Category…).
Must correspond with a product property present in the Product Feed |
String |
filterNumericValue | Specify a value for this property OR for filterStringValue, but not both. This affects how segmentation conditions are run. | Number |
filterStringValue | Specify a value for this property OR for filterNumericValue, but not both. This affects how segmentation conditions are run. | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:@"Color" forKey:@"filterType"]; // Name of filter (Color, Size, Brand, Fit, Author, Keyword, Category...)
[eventDictionary setObject:NUMERIC_VALUE forKey:@"filterNumericValue"]; // Either a string value OR a numeric value. This affects how segmentation conditions are run.
[eventDictionary setObject:STRING_VALUE forKey:@"filterStringValue"];
[eventDictionary setObject:@"filter-items-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Filter Items" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["filterType"] = "Color"; // Any of: Color, AGE, POPULARITY, RATING, OTHER
product["filterStringValue"] = STRING_VALUE; // Either a string value OR a numeric value. This affects how segmentation conditions are run.
product["filterNumericValue"] = NUMERIC_VALUE;
product["dyType"] = "filter-items-v1"
//Sending the Event
DYApi.getInstance().trackEvent("Filter Items", prop: product)
Java Example (Android)
//Populating the Prop parameter
JSONObject props = new JSONObject();
props.put( "filterType", "Color" ); // Any of: Color, AGE, POPULARITY, RATING, OTHER
props.put( "filterStringValue", STRING_VALUE ); // Either a string value OR a numeric value. This affects how segmentation conditions are run.
props.put( "filterNumericValue", NUMERIC_VALUE );
props.put( "dyType","filter-items-v1" );
//Sending the Event
DYApi.getInstance().trackEvent("Filter Items", props );
JavaScript Example (React Native)
DYReact.trackEvent(
"Filter Items"
{
dyType: "filter-items-v1",
filterType: "Color", // Name of filter (Color, Size, Brand, Fit, Author, Keyword, Category...)
filterNumericValue: 4
}
);
Aside from the predefined Event schemas above, visitors can be identified at any other relevant instance during their journey (e.g. within the checkout process) by calling the following Identify API.
Note: This event is only required for websites. When using a mobile application, Dynamic Yield handles user identification via the identifyUser API function.
DYReact.identifyUser({
uid: "c0e93cee791b35af528a825f6476e8108e5f03e481ee39800a31a75559cdba2e", //SHA 256 hashed email of the plain text email in lower case
type: "he"
}, err => {
if (err) {
console.log(`got error: ${err}`);
}
});
- Advanced users only
- Adds an identification method to the current user
- The identification can be later used by advanced users to connect with their own Business Intelligence systems
The user has run a free-style keyword search.
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “keyword-search-v1″ | String |
keywords | the search string, as-is | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:SEARCH_STRING forKey:@"keywords"];
[eventDictionary setObject:@"keyword-search-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Keyword Search" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["keywords"] = SEARCH_STRING
product["dyType"] = "keyword-search-v1"
//Sending the Event
DYApi.getInstance().trackEvent("Keyword Search", prop: product)
Java Example (Android)
//Populating the Prop parameter
JSONObject props = new JSONObject();
props.put( "keywords", SEARCH_STRING );
props.put( "dyType","keyword-search-v1" );
//Sending the Event
DYApi.getInstance().trackEvent("Keyword Search", props );
JavaScript Example (React Native)
DYReact.trackEvent(
"Keyword Search",
{
dyType: "keyword-search-v1",
keywords: "my search string"
}
);
The user has logged-in.A login event may optionally also serve to establish “user identification”, i.e. associating a customer ID with Dynamic Yield’s own user ID. Passing an e-mail as the user ID is usually preferable, as you’ll later be able to use Dynamic Yield’s e-mail capabilities for that user. However, we support any other ID type you wish to pass, and also support multiple ID types per user.
If the users’ email addresses are used as their unique identifier across the site and within the onboarded CRM data (recommended), then the “hashedEmail” field should be filled with SHA256(to_lower_case_(email)) encoded email address; if a custom identifier is used, then it should be passed in the “cuid” and “cuidType” (e.g. “webId” or “customerId”), instead of the “hashedEmail” field.
You have a few choices of what to include when sending this event:
- Send the event with just a hashed e-mail.
- Send the event with just a non-email CUID (Customer User ID). In this case you may decide to explicitly specify the type by also setting the “cuidType” property. If cuidType is not set, a default type named “id” is used.
- Send both an e-mail AND a non-email identifier. In this case, both will be linked with each other.
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “login-v1″ | String |
hashedEmail | SHA256 encoding of the lowercase e-mail, if the email is known (optional) | String |
cuid | If not identifying by e-mail, pass the customer ID (optional) | String |
cuidType | If not identifying by e-mail, pass the customer ID type (optional) | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:HASHED_EMAIL forKey:@"hashedEmail"];
[eventDictionary setObject:CUID forKey:@"cuid"];
[eventDictionary setObject:CUID_TYPE forKey:@"cuidType"];
[eventDictionary setObject:@"login-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"login" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var propsDic = Dictionary<string,any>();
propsDic[ "hashedEmail"] = HASHED_EMAIL;
propsDic[ "cuid"] = CUID;
propsDic[ "cuidType"] = CUID_TYPE;
propsDic[ "dyType"] = "login-v1";
//Sending the Event
DYApi.getInstance().trackEvent("login", prop: propsDic)
Java Example (Android)
//Populating the Prop parameter
JSONObject login = new JSONObject();
login.put("hashedEmail", HASHED_EMAIL);
login.put("cuid", CUID);
login.put("cuidType", CUID_TYPE);
login.put("dyType", "login-v1");
//Sending the Event
DYApi.getInstance().trackEvent("login", login);
JavaScript Example (React Native)
DYReact.trackEvent(
"Login",
{
dyType: "login-v1",
hashedEmail: "...", // SHA256 encoding of the lowercase e-mail, if known (optional)
cuid: "...", // If not identifying by e-mail, pass the customer ID (optional)
cuidType: "..." // If not identifying by e-mail, pass the customer ID type (optional)
}
);
Mark individual user emails to receive or not receive triggered emails. The email recipient list is managed by Dynamic Yield using these events.
Message Opt-In Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “message-optin-v1” | String |
cuidType | Must be “email” | String |
plainTextEmail | A valid plain text email address | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:@"REPLACE_WITH_EMAIL_ADDRESS" forKey:@"plainTextEmail"]; //mandatory, must be a valid plain text email address
[eventDictionary setObject:@"email" forKey:@"cuidType"]; //mandatory
[eventDictionary setObject:@"message-optin-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"message opt in" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var propsDic = Dictionary<string,any>();
propsDic[ "plainTextEmail"] = "REPLACE_WITH_EMAIL_ADDRESS"; //mandatory, must be a valid plain text email address
propsDic[ "cuidType"] = "email"; //mandatory
propsDic[ "dyType"] = "message-optin-v1";
//Sending the Event
DYApi.getInstance().trackEvent("message opt in", prop: propsDic)
Java Example (Android)
//Populating the Prop parameter
JSONObject login = new JSONObject();
login.put("plainTextEmail", "REPLACE_WITH_EMAIL_ADDRESS"); //mandatory, must be a valid plain text email address
login.put("cuidType", "email"); //mandatory
login.put("dyType", "message-optin-v1");
//Sending the Event
DYApi.getInstance().trackEvent("message opt in", login);
JavaScript Example (React Native)
DYReact.trackEvent(
"message opt in",
{
dyType: "message-optin-v1",
cuidType: "email", //mandatory
plainTextEmail: "REPLACE_WITH_EMAIL_ADDRESS", //mandatory, must be a valid plain text email address
}
);
Message Opt-Out Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “message-optout-v1” | String |
cuidType | Must be “he” | String |
hashedEmail | SHA256 hash of the plain-text email in lower case | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:@"REPLACE_WITH_HASHED_EMAIL" forKey:@"hashedEmail"]; //mandatory, SHA256 hash of the plain-text email in lower case.
[eventDictionary setObject:@"he" forKey:@"cuidType"]; //mandatory
[eventDictionary setObject:@"message-optout-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"message opt out" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var propsDic = Dictionary<string,any>();
propsDic[ "hashedEmail"] = "REPLACE_WITH_HASHED_EMAIL"; //mandatory, SHA256 hash of the plain-text email in lower case.
propsDic[ "cuidType"] = "he"; //mandatory
propsDic[ "dyType"] = "message-optout-v1";
//Sending the Event
DYApi.getInstance().trackEvent("message opt out", prop: propsDic)
Java Example (Android)
//Populating the Prop parameter
JSONObject login = new JSONObject();
login.put("hashedEmail", "REPLACE_WITH_HASHED_EMAIL"); //mandatory, SHA256 hash of the plain-text email in lower case.
login.put("cuidType", "he"); //mandatory
login.put("dyType", "message-optout-v1");
//Sending the Event
DYApi.getInstance().trackEvent("message opt out", login);
JavaScript Example (React Native)
DYReact.trackEvent(
"message opt out",
{
dyType: "message-optout-v1",
cuidType: "email", //mandatory
plainTextEmail: "REPLACE_WITH_EMAIL_ADDRESS", //mandatory, must be a valid plain text email address
}
);
The user has subscribed to a newsletter.
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “newsletter-subscription-v1” | String |
hashedEmail | “…” // SHA256 encoding of the lowercase e-mail, in textual hexadecimal representation | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:HASHED_EMAIL forKey:@"hashedEmail"];
[eventDictionary setObject:@"newsletter-subscription-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Newsletter Subscription" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["hashedEmail"] = HASHED_EMAIL;
product["dyType"] = "newsletter-subscription-v1"
//Sending the Event
DYApi.getInstance().trackEvent("Newsletter Subscription", prop: product)
Java Example (Android)
//Populating the Prop parameter
JSONObject props = new JSONObject();
props.put( "hashedEmail", HASHED_EMAIL );
props.put( "dyType","newsletter-subscription-v1" );
//Sending the Event
DYApi.getInstance().trackEvent("Newsletter Subscription", props );
JavaScript Example (React Native)
DYReact.trackEvent(
"Newsletter Subscription",
{
dyType: "newsletter-subscription-v1",
hashedEmail: "..." // SHA256 encoding of the lowercase e-mail,
// in textual hexadecimal representation
}
);
The user has entered a valid promo code.
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “enter-promo-code-v1″ | String |
code | The promo code | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:PROMO_CODE forKey:@"code"];
[eventDictionary setObject:@"enter-promo-code-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Promo Code Entered" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["code"] = PROMO_CODE;
product["dyType"] = "enter-promo-code-v1"
//Sending the Event
DYApi.getInstance().trackEvent("Promo Code Entered", prop: product)
Java Example (Android)
//Populating the Prop parameter
JSONObject props = new JSONObject();
props.put( "code", PROMO_CODE );
props.put( "dyType","enter-promo-code-v1" );
//Sending the Event
DYApi.getInstance().trackEvent("Promo Code Entered", props );
JavaScript Example (React Native)
DYReact.trackEvent(
"Promo Code Entered",
{
dyType: "enter-promo-code-v1",
code: "..."
}
);
The user has made a purchase.
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “purchase-v1” | String |
uniqueTransactionId | Will ensure only one purchase is reported per transaction. Must be a string. Max 64 characters. | String |
value | Total cart value in actual payment currency. | Float (dollars.cents). The number must be positive. Numbers are rounded to the nearest 0.01. Numbers smaller than 0.005 are rounded down to 0. |
currency | Optional non-default currency used | String |
cart |
The absolute current cart state (including the last added item). Products should be in order from oldest to newest. Cart Properties: |
|
productId: SKU exactly as it appears in the product feed |
String |
|
quantity | Number | |
itemPrice | Number. Numbers are rounded to the nearest 0.01. Numbers smaller than 0.005 are rounded down to 0. | |
size: Optional | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableArray* cart = [NSMutableArray array];
NSMutableDictionary* item = [NSMutableDictionary dictionary];
[item setObject:PRODUCT_ID forKey:@"productId"];
[item setObject:QUANTITY forKey:@"quantity"];
[item setObject:ITEM_PRICE forKey:@"itemPrice"];
[cart addObject:item]; //Add more items if needed
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:cart forKey:@"cart"];
[eventDictionary setObject:CART_VALUE forKey:@"value"];
[eventDictionary setObject:@"purchase-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Purchase" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["productId"] = PRODUCT_ID
product["quantity"] = QUANTITY
product["itemPrice"] = ITEM_PRICE
var cart = Array<dictionary<string, string="">>();
cart.append(product); //Add more items if needed
var propsDic = Dictionary<string,any>();
propsDic[ "dyType"] = "purchase-v1";
propsDic[ "value"] = CART_VALUE;
propsDic[ "cart"] = cart;
//Sending the Event
DYApi.getInstance().trackEvent("purchase", prop: propsDic)
Java Example (Android)
//Populating the Prop parameter
JSONArray cart = new JSONArray();
JSONObject product = new JSONObject();
product.put("productId", PRODUCT_ID);
product.put("quantity", QUANTITY);
product.put("itemPrice", ITEM_PRICE);
cart.put(product);
JSONObject purchase = new JSONObject();
purchase.put("dyType", "purchase-v1");
purchase.put("value", CART_VALUE);
purchase.put("cart", cart);
//Sending the Event
DYApi.getInstance().trackEvent("purchase", purchase);
JavaScript Example (React Native)
DYReact.trackEvent(
"Purchase",
{
uniqueTransactionId: "123456",
dyType: "purchase-v1",
value: 90.55,
currency: "any supported currency code",
cart: [
{
productId: "item-34454", // SKU exactly as in the product feed!
quantity: 1,
itemPrice: 65.87,
size: "XL"
}, {
productId: "sku-4324-bg",
quantity: 2,
itemPrice: 12.34,
size: "M"
}
]
}
);
The user has removed a product from the cart.
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “remove-from-cart-v1“ | String |
value | Total value in actual payment currency. | Float (dollars.cents). Numbers are rounded to the nearest 0.01. Numbers smaller than 0.005 are rounded down to 0. |
currency | Optional non-default currency used | String |
productId | SKU exactly as it appears in the product feed | String |
quantity | Number | |
size | Optional string, customer specific values | String |
cart (optional but recommended) |
The absolute current cart state (including the last added item). Products should be in order from oldest to newest. Cart Properties: |
|
productId: SKU exactly as it appears in the product feed |
String |
|
quantity | Number | |
itemPrice | Number. Numbers are rounded to the nearest 0.01. Numbers smaller than 0.005 are rounded down to 0. | |
size: Optional | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:ITEM_VALUE forKey:@"value"];
[eventDictionary setObject:PRODUCT_ID forKey:@"productId"];
[eventDictionary setObject:QUANTITY forKey:@"quantity"];
[eventDictionary setObject:@"remove-from-cart-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Remove from Cart" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["productId"] = PRODUCT_ID
product["quantity"] = QUANTITY
product["value"] = ITEM_VALUE
product["dyType"] = "remove-from-cart-v1"
//Sending the Event
DYApi.getInstance().trackEvent("remove from cart", prop: product)
Java Example (Android)
//Populating the Prop parameter
JSONObject props = new JSONObject();
props.put( "value", ITEM_VALUE );
props.put( "productId", PRODUCT_ID );
props.put( "quantity", QUANTITY );
props.put( "dyType","remove-from-cart-v1" );
//Sending the Event
DYApi.getInstance().trackEvent("Remove from Cart", props );
JavaScript Example (React Native)
DYReact.trackEvent(
"Remove from Cart",
{
dyType: "remove-from-cart-v1",
value: 34.45,
currency: "any supported currency code",
productId: "gswefd-34-454",
quantity: 1,
size: "XL"
cart: [{
productId: "sku-4324-bg",
quantity: 2,
itemPrice: 12.34,
},
{
productId: "item-34454",
quantity: 1,
itemPrice: 34.45
}
]
}
);
Trigger an event when the user has completed the sign-up process.You have a few choices of what to include when sending this event:
- Send the event with just a hashed e-mail.
- Send the event with just a non-email CUID (Customer User ID). In this case you may decide to explicitly specify the type by also setting the “cuidType” property. If cuidType is not set, a default type named “id” is used.
- Send both an e-mail AND a non-email identifier. In this case, both will be linked with each other.
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “signup-v1” | String |
hashedEmail | SHA256 encoding of the lowercase e-mail, if the email is known (optional) | String |
cuid | If not identifying by e-mail, pass the customer ID (optional) | String |
cuidType | If not identifying by e-mail, pass the customer ID type (optional) | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:HASHED_EMAIL forKey:@"hashedEmail"];
[eventDictionary setObject:@"signup-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Signup" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var propsDic = Dictionary<string,any>();
propsDic[ "hashedEmail"] = HASHED_EMAIL;
propsDic[ "dyType"] = "signup-v1";
//Sending the Event
DYApi.getInstance().trackEvent("Signup", prop: propsDic)
Java Example (Android)
//Populating the Prop parameter
JSONObject Signup = new JSONObject();
Signup.put("dyType", "signup-v1");
Signup.put("hashedEmail", HASHED_EMAIL);
//Sending the Event
DYApi.getInstance().trackEvent("Signup", Signup);
JavaScript Example (React Native)
DYReact.trackEvent(
"Signup",
{
dyType: "signup-v1",
hashedEmail: "...", // SHA256 encoding of the lowercase e-mail, if the e-mail is known
}
);
The user has changed the sorting of a product list.
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “sort-items-v1” | String |
sortBy | Any of: PRICE, AGE, POPULARITY, RATING, OTHER | String |
sortOrder | ASC or DESC | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:@"PRICE" forKey:@"sortBy"]; // Any of: PRICE, AGE, POPULARITY, RATING, OTHER
[eventDictionary setObject:@"ASC" forKey:@"sortOrder"]; // ASC or DESC
[eventDictionary setObject:@"sort-items-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Sort items" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["sortBy"] = "PRICE"; // Any of: PRICE, AGE, POPULARITY, RATING, OTHER
product["sortOrder"] = "ASC"; // ASC or DESC
product["dyType"] = "sort-items-v1"
//Sending the Event
DYApi.getInstance().trackEvent("Sort items", prop: product)
Java Example (Android)
//Populating the Prop parameter
JSONObject props = new JSONObject();
props.put( "sortBy", "PRICE" ); // Any of: PRICE, AGE, POPULARITY, RATING, OTHER
props.put( "sortOrder", "ASC" ); // ASC or DESC
props.put( "dyType","sort-items-v1" );
//Sending the Event
DYApi.getInstance().trackEvent("Sort items", props );
JavaScript Example (React Native)
DYReact.trackEvent(
"Sort Items",
{
dyType: "sort-items-v1",
sortBy: "PRICE",
sortOrder: "ASC"
}
);
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “sync-cart-v1” | String |
currency | Optional non-default currency used | String |
cart |
The absolute current cart state (including the last added item). Products should be in order from oldest to newest. Cart Properties: |
|
productId: SKU exactly as it appears in the product feed |
String |
|
quantity | Number | |
itemPrice | Number | |
size: Optional | String |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableArray* cart = [NSMutableArray array];
NSMutableDictionary* item = [NSMutableDictionary dictionary];
[item setObject:PRODUCT_ID forKey:@"productId"];
[item setObject:QUANTITY forKey:@"quantity"];
[item setObject:ITEM_PRICE forKey:@"itemPrice"];
[cart addObject:item]; //Add more items if needed
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:cart forKey:@"cart"];
[eventDictionary setObject:@"sync-cart-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Sync Cart" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var product = Dictionary<string, string="">();
product["productId"] = PRODUCT_ID
product["quantity"] = QUANTITY
product["itemPrice"] = ITEM_PRICE
var cart = Array<dictionary<string, string="">>();
cart.append(product); //Add more items if needed
var propsDic = Dictionary<string,any>();
propsDic[ "dyType"] = "sync-cart-v1";
propsDic[ "cart"] = cart;
//Sending the Event
DYApi.getInstance().trackEvent("Sync Cart", prop: propsDic)
Java Example (Android)
//Populating the Prop parameter
JSONArray cart = new JSONArray();
JSONObject product = new JSONObject();
product.put("productId", PRODUCT_ID);
product.put("quantity", QUANTITY);
product.put("itemPrice", ITEM_PRICE);
cart.put(product);
JSONObject purchase = new JSONObject();
purchase.put("dyType", "sync-cart-v1");
purchase.put("cart", cart);
//Sending the Event
DYApi.getInstance().trackEvent("Sync Cart", purchase);
JavaScript Example (React Native)
DYReact.trackEvent(
"Sync cart",
{
dyType: "sync-cart-v1",
currency: "any supported currency code", // Optional non-default currency used
cart: [ //Mandatory, the order of products should be from oldest to newest
{
productId: "sku-4324-bg",
quantity: 2,
itemPrice: 12.34,
},
{
productId: "item-34454",
quantity: 1,
itemPrice: 34.45
}
]
}
);
The user has watched a video (in part or in full). You can distinguish between auto-playing videos and those that were explicitly clicked on by the user.
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the table below.
Property | Description | Type |
---|---|---|
dyType | Must be “video-watch-v1″ | String |
itemId | Mandatory string ID – must match an id present in the Content Feed | String |
categories | Optional string | String |
autoplay | true/false. Indicates if video was played automatically or because of a direct user action. False by default. | Boolean |
progress | One of the following values:
|
String |
progressPercent | Only relevant if progress mode is “VIDEO_PROGRESS” | Number |
Objective C Example (iOS)
//Populating the Prop parameter
NSMutableDictionary* eventDictionary = [NSMutableDictionary dictionary];
[eventDictionary setObject:ITEM_ID forKey:@"itemId"];
[eventDictionary setObject:CATEGORIES forKey:@"categories"];
[eventDictionary setObject:AUTOPLAY forKey:@"autoplay"]; // Default is false, Specifies whether the user has explicitly requested the video to play
[eventDictionary setObject:VIDEO_PROGRESS forKey:@"progress"];
[eventDictionary setObject:PROGRESS_PERCENT forKey:@"progressPercent"]; // Meaning: 65% of video length has passed. Only relevant if progress mode is "VIDEO_PROGRESS"
[eventDictionary setObject:@"video-watch-v1" forKey:@"dyType"];
//Sending the Event
[[DYApi getInstance] trackEvent:@"Video Watch" prop:eventDictionary];
Swift Example (iOS)
//Populating the Prop parameter
var propsDic = Dictionary<string,any>();
propsDic[ "itemId"] = ITEM_ID;
propsDic[ "categories"] = CATEGORIES;
propsDic[ "autoplay"] = AUTOPLAY;
propsDic[ "progress"] = VIDEO_PROGRESS;
propsDic[ "progressPercent"] = PROGRESS_PERCENT;
propsDic[ "dyType"] = "video-watch-v1";
//Sending the Event
DYApi.getInstance().trackEvent("Video Watch", prop: propsDic)
Java Example (Android)
//Populating the Prop parameter
JSONObject videoWatch = new JSONObject();
videoWatch.put("itemId", ITEM_ID);
videoWatch.put("categories", CATEGORIES);
videoWatch.put("autoplay", AUTOPLAY);
videoWatch.put("progress", VIDEO_PROGRESS);
videoWatch.put("progressPercent", PROGRESS_PERCENT);
Video Watch.put("dyType", "video-watch-v1");
//Sending the Event
DYApi.getInstance().trackEvent("Video Watch", Video Watch);
JavaScript Example (React Native)
DYReact.trackEvent(
"Video Watch",
{
dyType: "video-watch-v1",
itemId: "...", // Mandatory string ID - must match an id present in the Content Feed
categories: ["Sports", "Baseball"], // Optional, independent of whether an ID was given
autoplay: true,
progress: "VIDEO_PROGRESS",
progressPercent: 65 // Meaning: 65% of video length has passed.
}
);
Custom Events
To send an event with unique or custom data to Dynamic Yield, or to send data from third parties, you can create custom events.
For details, see Custom Mobile Event Configuration.
Validating Events
You can validate that your events have been configured properly using the Implementation Status dashboard and the Mobile Implementation Helper. For details, see Validating Event Implementation.