Select Promotion
Triggered when a user selects a promotion.
DataLayer Example
- Android Firebase (Kotlin)
- Android Firebase (Java)
- iOS Firebase (Swift)
- iOS Firebase (Obj-C)
val item1 = Bundle().apply {
putString(FirebaseAnalytics.Param.ITEM_ID, "SKU_12345")
putString(FirebaseAnalytics.Param.ITEM_NAME, "Stan and Friends Tee")
putString(FirebaseAnalytics.Param.AFFILIATION, "Google Merchandise Store")
putString(FirebaseAnalytics.Param.COUPON, "SUMMER_FUN")
putDouble(FirebaseAnalytics.Param.DISCOUNT, 2.22)
putLong(FirebaseAnalytics.Param.INDEX, 0L)
putString(FirebaseAnalytics.Param.ITEM_BRAND, "Google")
putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "Apparel")
putString(FirebaseAnalytics.Param.ITEM_CATEGORY2, "Adult")
putString(FirebaseAnalytics.Param.ITEM_CATEGORY3, "Shirts")
putString(FirebaseAnalytics.Param.ITEM_CATEGORY4, "Crew")
putString(FirebaseAnalytics.Param.ITEM_CATEGORY5, "Short sleeve")
putString(FirebaseAnalytics.Param.ITEM_LIST_ID, "related_products")
putString(FirebaseAnalytics.Param.ITEM_LIST_NAME, "Related Products")
putString(FirebaseAnalytics.Param.ITEM_VARIANT, "green")
putString(FirebaseAnalytics.Param.LOCATION_ID, "ChIJIQBpAG2ahYAR_6128GcTUEo")
putDouble(FirebaseAnalytics.Param.PRICE, 10.01)
putLong(FirebaseAnalytics.Param.QUANTITY, 1L)
putString(FirebaseAnalytics.Param.PROMOTION_ID, "P_12345")
putString(FirebaseAnalytics.Param.PROMOTION_NAME, "Summer Sale")
putString(FirebaseAnalytics.Param.CREATIVE_NAME, "summer_banner2")
putString(FirebaseAnalytics.Param.CREATIVE_SLOT, "featured_app_1")
putString("google_business_vertical", "retail")
}
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_PROMOTION) {
param(FirebaseAnalytics.Param.PROMOTION_ID, "P_12345")
param(FirebaseAnalytics.Param.PROMOTION_NAME, "Summer Sale")
param(FirebaseAnalytics.Param.CREATIVE_NAME, "summer_banner")
param(FirebaseAnalytics.Param.CREATIVE_SLOT, "featured_app_1")
param(FirebaseAnalytics.Param.ITEMS, arrayOf(item1))
}
Bundle item1 = new Bundle();
item1.putString(FirebaseAnalytics.Param.ITEM_ID, "SKU_12345");
item1.putString(FirebaseAnalytics.Param.ITEM_NAME, "Stan and Friends Tee");
item1.putString(FirebaseAnalytics.Param.AFFILIATION, "Google Merchandise Store");
item1.putString(FirebaseAnalytics.Param.COUPON, "SUMMER_FUN");
item1.putDouble(FirebaseAnalytics.Param.DISCOUNT, 2.22);
item1.putLong(FirebaseAnalytics.Param.INDEX, 0L);
item1.putString(FirebaseAnalytics.Param.ITEM_BRAND, "Google");
item1.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "Apparel");
item1.putString(FirebaseAnalytics.Param.ITEM_CATEGORY2, "Adult");
item1.putString(FirebaseAnalytics.Param.ITEM_CATEGORY3, "Shirts");
item1.putString(FirebaseAnalytics.Param.ITEM_CATEGORY4, "Crew");
item1.putString(FirebaseAnalytics.Param.ITEM_CATEGORY5, "Short sleeve");
item1.putString(FirebaseAnalytics.Param.ITEM_LIST_ID, "related_products");
item1.putString(FirebaseAnalytics.Param.ITEM_LIST_NAME, "Related Products");
item1.putString(FirebaseAnalytics.Param.ITEM_VARIANT, "green");
item1.putString(FirebaseAnalytics.Param.LOCATION_ID, "ChIJIQBpAG2ahYAR_6128GcTUEo");
item1.putDouble(FirebaseAnalytics.Param.PRICE, 10.01);
item1.putLong(FirebaseAnalytics.Param.QUANTITY, 1L);
item1.putString(FirebaseAnalytics.Param.PROMOTION_ID, "P_12345");
item1.putString(FirebaseAnalytics.Param.PROMOTION_NAME, "Summer Sale");
item1.putString(FirebaseAnalytics.Param.CREATIVE_NAME, "summer_banner2");
item1.putString(FirebaseAnalytics.Param.CREATIVE_SLOT, "featured_app_1");
item1.putString("google_business_vertical", "retail");
Bundle eventParams = new Bundle();
eventParams.putString(FirebaseAnalytics.Param.PROMOTION_ID, "P_12345");
eventParams.putString(FirebaseAnalytics.Param.PROMOTION_NAME, "Summer Sale");
eventParams.putString(FirebaseAnalytics.Param.CREATIVE_NAME, "summer_banner");
eventParams.putString(FirebaseAnalytics.Param.CREATIVE_SLOT, "featured_app_1");
eventParams.putParcelableArray(FirebaseAnalytics.Param.ITEMS, new Parcelable[]{item1});
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_PROMOTION, eventParams);
var item1: [String: Any] = [
AnalyticsParameterItemID: "SKU_12345",
AnalyticsParameterItemName: "Stan and Friends Tee",
AnalyticsParameterAffiliation: "Google Merchandise Store",
AnalyticsParameterCoupon: "SUMMER_FUN",
AnalyticsParameterDiscount: 2.22,
AnalyticsParameterIndex: 0,
AnalyticsParameterItemBrand: "Google",
AnalyticsParameterItemCategory: "Apparel",
AnalyticsParameterItemCategory2: "Adult",
AnalyticsParameterItemCategory3: "Shirts",
AnalyticsParameterItemCategory4: "Crew",
AnalyticsParameterItemCategory5: "Short sleeve",
AnalyticsParameterItemListID: "related_products",
AnalyticsParameterItemListName: "Related Products",
AnalyticsParameterItemVariant: "green",
AnalyticsParameterLocationID: "ChIJIQBpAG2ahYAR_6128GcTUEo",
AnalyticsParameterPrice: 10.01,
AnalyticsParameterQuantity: 1,
AnalyticsParameterPromotionID: "P_12345",
AnalyticsParameterPromotionName: "Summer Sale",
AnalyticsParameterCreativeName: "summer_banner2",
AnalyticsParameterCreativeSlot: "featured_app_1",
"google_business_vertical": "retail"
]
var eventParams: [String: Any] = [
AnalyticsParameterPromotionID: "P_12345",
AnalyticsParameterPromotionName: "Summer Sale",
AnalyticsParameterCreativeName: "summer_banner",
AnalyticsParameterCreativeSlot: "featured_app_1"
]
eventParams[AnalyticsParameterItems] = [item1]
Analytics.logEvent(AnalyticsEventSelectPromotion, parameters: eventParams)
NSMutableDictionary *item1 = [@{
kFIRParameterItemID: @"SKU_12345",
kFIRParameterItemName: @"Stan and Friends Tee",
kFIRParameterAffiliation: @"Google Merchandise Store",
kFIRParameterCoupon: @"SUMMER_FUN",
kFIRParameterDiscount: @(2.22),
kFIRParameterIndex: @(0),
kFIRParameterItemBrand: @"Google",
kFIRParameterItemCategory: @"Apparel",
kFIRParameterItemCategory2: @"Adult",
kFIRParameterItemCategory3: @"Shirts",
kFIRParameterItemCategory4: @"Crew",
kFIRParameterItemCategory5: @"Short sleeve",
kFIRParameterItemListID: @"related_products",
kFIRParameterItemListName: @"Related Products",
kFIRParameterItemVariant: @"green",
kFIRParameterLocationID: @"ChIJIQBpAG2ahYAR_6128GcTUEo",
kFIRParameterPrice: @(10.01),
kFIRParameterQuantity: @(1),
kFIRParameterPromotionID: @"P_12345",
kFIRParameterPromotionName: @"Summer Sale",
kFIRParameterCreativeName: @"summer_banner2",
kFIRParameterCreativeSlot: @"featured_app_1",
@"google_business_vertical": @"retail"
} mutableCopy];
NSMutableDictionary *eventParams = [@{
kFIRParameterPromotionID: @"P_12345",
kFIRParameterPromotionName: @"Summer Sale",
kFIRParameterCreativeName: @"summer_banner",
kFIRParameterCreativeSlot: @"featured_app_1"
} mutableCopy];
eventParams[kFIRParameterItems] = @[item1];
[FIRAnalytics logEventWithName:kFIREventSelectPromotion parameters:eventParams];
Event Properties
| Property | Type | Constraints | Examples | Description |
|---|---|---|---|---|
| $schema | string | required | | Defines the structure of the event. |
const: "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/mobile/select-promotion-event.json" | ||||
| event | string | required | | The event name select_promotion. |
const: "select_promotion" | ||||
| promotion_id | string | | ID of the promotion. | |
| promotion_name | string | | Name of the promotion. | |
| creative_name | string | | Name of the promotion creative. | |
| creative_slot | string | | Creative slot associated with the promotion. | |
| []items | array | minItems: 1 | Items associated with this ecommerce event. | |
| item_id | string | | The ID of the item. Either item_id or item_name is required. | |
| item_name | string | | The name of the item. Either item_id or item_name is required. | |
| affiliation | string | | A product affiliation to indicate a supplier or store. Note: affiliation is only available at the item level. | |
| coupon | string | | The coupon name/code associated with the item. Coupon parameters at event and item levels are independent. | |
| discount | number | | The monetary value of the discount per unit applied to the item. | |
| index | number | | The index or position of the item in a list. | |
| item_brand | string | | The brand of the item. | |
| item_category | string | | The category of the item. If used as part of a category hierarchy or taxonomy, this is the first category. | |
| item_category2 | string | | The second category hierarchy or additional taxonomy of the item. | |
| item_category3 | string | | The third category hierarchy or additional taxonomy of the item. | |
| item_category4 | string | | The fourth category hierarchy or additional taxonomy of the item. | |
| item_category5 | string | | The fifth category hierarchy or additional taxonomy of the item. | |
| item_list_id | string | | The ID of the list in which the item was presented to the user. If set, item_list_id at the event level is ignored. If not set, item_list_id at the event level is used if available. | |
| item_list_name | string | | The name of the list in which the item was presented to the user. If set, item_list_name at the event level is ignored. If not set, item_list_name at the event level is used if available. | |
| item_variant | string | | The item variant or unique code or description for additional item details/options. | |
| location_id | string | | The physical location associated with the item, such as the location of a brick-and-mortar store. It is recommended to use the Google Place ID that corresponds to the associated item. A custom location ID can also be used. Note: location_id is only available at the item level. | |
| price | number | | The price of the item in the specified currency unit. If a discount is applied to the item, set price to the reduced per-unit price and provide the per-unit price discount in the discount parameter. | |
| quantity | number | default: 1 | | The item quantity. If not set, quantity is set to 1. |
| promotion_id | string | | The ID of the promotion associated with the item. | |
| promotion_name | string | | The name of the promotion associated with the item. | |
| creative_name | string | | The name of the promotion creative. | |
| creative_slot | string | | The name of the creative slot associated with the item. | |
| google_business_vertical | string | | The business vertical for the item (e.g., 'retail'). | |
additionalPropertiesSchema constraintControls properties not listed in properties and not matched by patternProperties. | string, number, integer, boolean, null | |||
additionalPropertiesSchema constraintControls properties not listed in properties and not matched by patternProperties. | string, number, integer, boolean, null |
View Raw JSON Schema
{
: "https://json-schema.org/draft/2020-12/schema",
: "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/mobile/select-promotion-event.json",
"title": "Select Promotion",
"description": "Triggered when a user selects a promotion.",
"x-tracking-targets": [
"android-firebase-kotlin-sdk",
"android-firebase-java-sdk",
"ios-firebase-swift-sdk",
"ios-firebase-objc-sdk"
],
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "Defines the structure of the event.",
"const": "https://tracking-docs-demo.buchert.digital/schemas/1.3.0/mobile/select-promotion-event.json"
},
"event": {
"type": "string",
"const": "select_promotion",
"description": "The event name select_promotion."
},
"promotion_id": {
"type": "string",
"description": "ID of the promotion.",
"examples": [
"P_12345"
]
},
"promotion_name": {
"type": "string",
"description": "Name of the promotion.",
"examples": [
"Summer Sale"
]
},
"creative_name": {
"type": "string",
"description": "Name of the promotion creative.",
"examples": [
"summer_banner"
]
},
"creative_slot": {
"type": "string",
"description": "Creative slot associated with the promotion.",
"examples": [
"featured_app_1"
]
},
"items": {
"$ref":
}
},
"required": [
"$schema",
"event"
],
"allOf": [
{
"$ref": "https://tracking-docs-demo.buchert.digital/constraints/schemas/firebase/v1/flat-event-params.json"
}
]
}