Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Store Page Hybrid Log Event

There's some event that we've implemented in our current store page. CleverTap, facebook, google.

Clevertap

Trigger: when loaded restaurant page Event Name: Restaurant Viewed Event Property:

property nameproperty valuenotes
idrestaurant id
packageTypestype_codearray to string separated by comma
primaryCuisinecuisine
primaryLocationlocation
locationslocationsarray to string separated by comma
ratingreviews_score
hasVideovideosif size > 0 = true
namerestaurant name
availabilityavailability
canonical_linkcanonical_link
restaurant_name_enrestaurant_name_en
restaurant_name_threstaurant_name_th
branchIdbranch_id(if any, not mandatory)
myFavoritefavoritednot sure this still working or not

Updated Data for Netcore:

property nameproperty valuenotes
idrestaurant id
package_typestype_codearray to string separated by comma
primary_cuisine_id13to string
primary_cuisine_namecuisine
primary_location_id12to string
primary_location_namelocation
locationlocationsarray to string separated by comma
ratingreviews_scorefloat (e.g. 4.8)has_video
has_videoyesif size > 0 = "yes" else "no"
namerestaurant name
availabilityavailability
canonical_linkcanonical_link
restaurant_name_enrestaurant_name_en
restaurant_name_threstaurant_name_th
branch_idbranch_id(if any convert to "string")
image_urlimage_cover_url.large
urlcaonical_link
my_favoritefavoritedif true = "yes" else "no"

/

Trigger: when click book button at the package Event Name: Initiated to Book Event Property:

property nameproperty valuenotes
restaurant_idrestaurant id
restaurant_namename
canonical_linkcanonical_link
restaurant_name_enrestaurant_name_en
restaurant_name_threstaurant_name_th

Hybrid Event: onCleverTapPushEvent Response:

{
	"event_name": "Initiated to Book", // event name
	"data": [ // event property
		{
			"name": "restaurant_id",
			"value": "997"
		},
		{
			"name": "restaurant_name",
			"value": "Cafe Calire"
		},
		{
			"name": "cuisine",
			"value": "Pizza"
		},......
	]
}

in Android:

HashMap<String, Object> map = new HashMap<>();
for (int i = 0; i < dataList.size(); i++) {
    String name = data.get(i).getName();
    String value = data.get(i).getValue();
    map.put(name, value);
}
clevertapDefaultInstance.pushEvent(event_name, map);

in iOS:

let props = [
    "restaurant_id": "997",
    "restaurant_name": "Cafe Claire",
    "cuisine": "Pizza",
    "name": "value"
] as [String : Any]

CleverTap.sharedInstance()?.recordEvent(event_name, withProps: props)

PS: not sure how do loop in swift wkwk

Google Analytics

Trigger: when loaded restaurant page Event Name: view_item Event Property:

property nameproperty valuenotes
currencyprice_and_pricing_type.currencystring
valueprice_and_pricing_type.amountinteger
itemsitem_id, item_name, category

Trigger: when click book button at the package Event Name: add_to_cart Event Property:

property nameproperty valuenotes
currencycurrencystring
valuelowest price from attributes rulesinteger
itemsitem_id, item_name, category

More or less the data is similar like above, only need to change value with package lowest price instead from restaurant data. a For google a little bit tricky not sure can be simple like clevertap since the data not always string. To make it right, we'll put separated param with type to handle which data that match. Hybrid Event: onGooglePushEvent Response:

{
	"event_name": "view_item",
	"data": [
		{
			"name": "currency",
			"type": "string",
			"string_value": "THB",
			"number_value": null,
			"items": null
		},
		{
			"name": "value",
			"type": "double",
			"string_value": null,
			"number_value": 599,
			"items": null
		},
		{
			"name": "items",
			"type": "array",
			"string_value": null,
			"number_value": 599,
			"items": [
				{
					"name": "item_id",
					"value": "997"
				},
				{
					"name": "item_name",
					"value": "Cafe Claire"
				},
				{
					"name": "category",
					"value": "Pizza"
				}
			]
		}
	]
}

in Android will be like this:

Bundle bundle = new Bundle();
bundle.putString("currency", "THB");
bundle.putDouble("value", 599);

Bundle items = new Bundle();
items.putString("item_id", "997");
items.putString("item_name", "Cafe Claire");
items.putString("category", "Pizza");

bundle.putParcelableArray("items", new Parcelable[]{items});

mFirebaseAnalytics.logEvent(event_name, bundle);

in iOS will be like this:

 var productDetails: [String: Any] = [
  "currency": "THB",
  "value": 599
]
var items: [String: Any] = [
  "item_id": "997",
  "item_name": "Cafe Claire",
  "category": "Pizza"
]

// Add items array
productDetails["items"] = [items]

// Log view item event
Analytics.logEvent(event_name, parameters: productDetails)

Trigger: when click book button at the package Event Name: add_to_cart Event Property:

property nameproperty valuenotes
currencycurrencystring
valuelowest price from attributes rulesinteger
itemsitem_id, item_name, category

More or less the data is similar like above, only need to change value with package lowest price instead from restaurant data.

Facebook Event

Trigger: when loaded restaurant page Event Name: fb_mobile_content_view Event Property:

property nameproperty valuenotes
fb_contentrestaurant idstring
fb_content_idrestaurant idstring
fb_content_typeproductstring
fb_currencyprice_and_pricing_type.currencystring

Trigger: when click book button at the package Event Name: fb_mobile_add_to_cart Event Property:

property nameproperty valuenotes
fb_contentrestaurant idstring
fb_content_idrestaurant idstring
fb_content_typeproductstring
fb_currencyprice_and_pricing_type.currencystring

Facebook event set price separately with params. So, we also need to setup that as separate value. Hybrid Event: onFacebookPushEvent Response:

{
	"event_name": "fb_mobile_content_view",
	"price": 599,
	"data": [
		{
			"name": "fb_content",
			"value": "997"
		},
		{
			"name": "fb_content_id",
			"value": "997"
		},
		{
			"name": "fb_content_type",
			"value": "product"
		},
		{
			"name": "fb_currency",
			"value": "THB"
		}
	]
}

in Android:

Bundle params = new Bundle();
// simplify with array
for (int i = 0; i < dataList.size(); i++) {
    String name = data.get(i).getName();
    String value = data.get(i).getValue();
    params.putString(name, value);
}
// more or less will looks like this:
params.putString("fb_content", "997");
params.putString("fb_content_id", "997");
params.putString("fb_content_type", "product");
params.putString("fb_currency", "THB");

logger.logEvent(event_name, price, params);

in iOS: I'm not sure how to write in swift but when I check google I only see this from facebook docs https://developers.facebook.com/docs/app-events/best-practices/ecom-and-retail