Track Internal Promotion Events
Internal promotion events are used for tracking views and interactions with internal promotion content on your e-commerce store. Such content can be:
- Hero banners/sliders on the homepage, category page etc.
- Sale specific banners e.g. seasonal sales, bundle discounts, free shipping.
- Category promotion on standard layout slots.
Internal promotion view event
In this section, we will showcase how to track promotion views.
trackPromotionView
To track a promotion view you can use the trackPromotionView
method with the following attributes:
import { trackPromotionView } from '@snowplow/browser-plugin-snowplow-ecommerce';
trackPromotionView(promotion: Promotion);
- Where
promotion
is the description of the promotion currently being viewed.
Example usage:
import { trackPromotionView } from "@snowplow/browser-plugin-snowplow-ecommerce";
/* Carousel slide 1 viewed */
trackPromotionView({
id: 'IP1234',
name: 'promo_winter',
type: 'carousel',
position: 1,
product_ids: ['P1234'],
});
/* On carousel slide 2 view */
trackPromotionView({
id: 'IP1234',
name: 'promo_winter',
type: 'carousel',
position: 2,
product_ids: ['P1235'],
});
trackPromotionView
To track a promotion view you can use the trackPromotionView
method with the following attributes:
/* {trackerName} is a placeholder for the initialized tracker on your page. */
window.snowplow("trackPromotionView:{trackerName}", promotion: Promotion);
- Where
promotion
is the description of the promotion currently being viewed.
Example usage:
/* Carousel slide 1 viewed */
window.snowplow("trackPromotionView:{trackerName}", {
id: 'IP1234',
name: 'promo_winter',
type: 'carousel',
position: 1,
product_ids: ['P1234'],
});
/* On carousel slide 2 view */
window.snowplow("trackPromotionView:{trackerName}", {
id: 'IP1234',
name: 'promo_winter',
type: 'carousel',
position: 2,
product_ids: ['P1235'],
});
Internal promotion click event
In this section, we will showcase how to track a click/selection of an internal promotion.
trackPromotionClick
To track a click/selection of an internal promotion you can use the trackPromotionClick
method with the following attributes:
import { trackPromotionClick } from "@snowplow/browser-plugin-snowplow-ecommerce";
trackPromotionClick(promotion: Promotion);
- Where
promotion
is the description of the promotion clicked/selected.
Example usage:
import { trackPromotionClick } from "@snowplow/browser-plugin-snowplow-ecommerce";
trackPromotionClick({
id: 'IP1234',
name: 'promo_winter',
type: 'carousel',
position: 1,
product_ids: ['P1234'],
});
trackPromotionClick
To track a click/selection of an internal promotion you can use the trackPromotionClick
method with the following attributes:
/* {trackerName} is a placeholder for the initialized tracker on your page. */
window.snowplow("trackPromotionClick:{trackerName}", promotion: Promotion);
- Where
promotion
is the description of the promotion clicked/selected.
Example usage:
window.snowplow("trackPromotionClick:{trackerName}", {
id: 'IP1234',
name: 'promo_winter',
type: 'carousel',
position: 1,
product_ids: ['P1234'],
});
Where promotion
can have the following attributes:
attribute | type | description | required |
---|---|---|---|
id | string | ID of the promotion. | ✅ |
name | string | Friendly name for the promotion. | ✘ |
product_ids | string[] | Array of SKUs or product IDs showcased in the promotion. | ✘ |
position | number | position the promotion was presented in a list of promotions E.g. in a slider. | ✘ |
creative_id | string | Identifier/Name/Url for the creative presented on the promotion. | ✘ |
type | string | Type of the promotion delivery mechanism. E.g. popup, banner, intra-content. | ✘ |
slot | string | The website slot in which the promotional content was added to. E.g. Identifier for slot sidebar-1, intra-content-2. | ✘ |