RudderStack
Sends each tracking event to the page's rudderanalytics as the 0.4.x RudderStack provider did: the same page(), identify() and track() calls, event names and properties, so RudderStack destinations and warehouse tables built on 0.4.x keep working. Vendor docs: RudderStack ecommerce spec.
Config
Off by default. On:
<script>
window.nextConfig = {
analytics: {
destinations: { rudderstack: { enabled: true } },
},
};
</script>The 0.4.x analytics.providers.rudderstack.enabled: true turns it on too.
What loads
rudderstack-*.js (about 3 KB), only when it is on. The SDK never loads RudderStack: the page has its JavaScript SDK snippet, whose ready() the SDK waits for. Without rudderanalytics the SDK logs one warning and sends nothing.
Events
page_viewed is a page() and a <Page type> Page View track: the page type is <meta name="next-page-type">, else nextConfig.pageType, else product; the page name <meta name="next-page-name">, else the page's title. Every track carries page_type, page_name and the campaign_* fields. cart_id and checkout_id are the session id, the same across the cart, the checkout and the order. identify() comes when the shopper leaves their details (with an email) and before each Order Completed, from the order's billing address. Checkout Step Completed is sent once per checkout, for the first of its two tracking events. Order Completed prices are before tax, unless the campaign's prices include it, with total = subtotal + tax + shipping; each accepted upsell is an Order Completed of its own.
page
page(page type, page name, properties), then a <Page type> Page View track with page_name added. See the RudderStack reference.
From page_viewed.
The fields of RudderStackPageProperties.
rudderanalytics.page('product', 'Olympus Earbuds', {
path: '/checkout/',
url: 'https://shop.test/checkout/',
title: 'Olympus Earbuds',
referrer: '',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});
rudderanalytics.track('Product Page View', {
page_name: 'Olympus Earbuds',
path: '/checkout/',
url: 'https://shop.test/checkout/',
title: 'Olympus Earbuds',
referrer: '',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});identify
identify(email, traits) once the shopper left their details, and identify(email or order id, traits) before each Order Completed. See the RudderStack reference.
From checkout_contact_info_submitted, checkout_completed, upsell_completed.
The fields of RudderStackTraits.
rudderanalytics.identify('jane@example.com', {
email: 'jane@example.com',
firstName: 'Jane',
lastName: 'Doe',
});Product Viewed
A product the shopper sees. See the RudderStack reference.
From product_viewed.
The fields of RudderStackProduct and RudderStackContext, and:
| Field | Type | |
|---|---|---|
currency | string | ISO 4217, such as USD. |
rudderanalytics.track('Product Viewed', {
product_id: '400',
sku: '11',
name: 'Earbuds ×1',
price: 49,
quantity: 1,
url: 'https://shop.test/checkout/',
position: 0,
category: 'Olympus',
image_url: 'https://cdn.test/1.png',
currency: 'USD',
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Product List Viewed
The products a page shows. See the RudderStack reference.
From product_list_viewed.
The fields of RudderStackContext, and:
| Field | Type | |
|---|---|---|
products | RudderStackProduct[] | |
currency | string | ISO 4217, such as USD. |
list_id | "product_list" | |
category | "Product List" |
rudderanalytics.track('Product List Viewed', {
products: [
{
product_id: '400',
sku: '11',
name: 'Earbuds ×1',
price: 49,
quantity: 1,
url: 'https://shop.test/checkout/',
position: 0,
category: 'Olympus',
image_url: 'https://cdn.test/1.png',
},
{
product_id: '400',
sku: '12',
name: 'Earbuds ×2',
price: 44.5,
quantity: 2,
url: 'https://shop.test/checkout/',
position: 1,
category: 'Olympus',
image_url: 'https://cdn.test/2.png',
},
],
currency: 'USD',
list_id: 'product_list',
category: 'Product List',
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Product Added
A product added to the cart. See the RudderStack reference.
From product_added_to_cart.
The fields of RudderStackProduct and RudderStackContext, and:
| Field | Type | |
|---|---|---|
cart_id | string | The session id: the same on the cart, the checkout and the order. |
currency | string | ISO 4217, such as USD. |
rudderanalytics.track('Product Added', {
cart_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
product_id: '400',
sku: '11',
name: 'Earbuds ×1',
price: 49,
quantity: 1,
url: 'https://shop.test/checkout/',
position: 0,
category: 'Olympus',
image_url: 'https://cdn.test/1.png',
currency: 'USD',
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Product Removed
A product removed from the cart. See the RudderStack reference.
From product_removed_from_cart.
The fields of RudderStackProduct and RudderStackContext, and:
| Field | Type | |
|---|---|---|
cart_id | string | The session id: the same on the cart, the checkout and the order. |
currency | string | ISO 4217, such as USD. |
rudderanalytics.track('Product Removed', {
cart_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
product_id: '400',
sku: '11',
name: 'Earbuds ×1',
price: 49,
quantity: 1,
url: 'https://shop.test/checkout/',
position: 0,
category: 'Olympus',
image_url: 'https://cdn.test/1.png',
currency: 'USD',
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Cart Viewed
The cart after a price update. See the RudderStack reference.
From cart_updated.
The fields of RudderStackContext, and:
| Field | Type | |
|---|---|---|
cart_id | string | The session id: the same on the cart, the checkout and the order. |
products | RudderStackProduct[] | |
currency | string | ISO 4217, such as USD. |
value | number | Σ price × quantity of products. |
rudderanalytics.track('Cart Viewed', {
cart_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
products: [
{
product_id: '400',
sku: '11',
name: 'Earbuds ×1',
price: 49,
quantity: 1,
url: 'https://shop.test/checkout/',
position: 0,
category: 'Olympus',
image_url: 'https://cdn.test/1.png',
},
],
currency: 'USD',
value: 49,
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Checkout Started
The checkout started. See the RudderStack reference.
From checkout_started.
The fields of RudderStackContext, and:
| Field | Type | Present | |
|---|---|---|---|
value | number | always | Σ price × quantity of products. |
revenue | number | always | The same as value. |
currency | string | always | ISO 4217, such as USD. |
affiliation | string | always | The campaign's name. |
products | RudderStackProduct[] | always | |
shipping | number | optional | |
coupon | string | optional | The first code the shopper applied. |
rudderanalytics.track('Checkout Started', {
value: 49,
revenue: 49,
currency: 'USD',
affiliation: 'Olympus',
products: [
{
product_id: '400',
sku: '11',
name: 'Earbuds ×1',
price: 49,
quantity: 1,
url: 'https://shop.test/checkout/',
position: 0,
category: 'Olympus',
image_url: 'https://cdn.test/1.png',
},
],
shipping: 0,
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Checkout Step Completed
The shipping step: once per checkout, for the first of its address and method. See the RudderStack reference.
From checkout_shipping_address_submitted, checkout_shipping_method_submitted.
The fields of RudderStackContext, and:
| Field | Type | |
|---|---|---|
checkout_id | string | The session id: the same on the cart, the checkout and the order. |
step | 2 | |
shipping_method | string | The method's name, else Standard. |
rudderanalytics.track('Checkout Step Completed', {
checkout_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
step: 2,
shipping_method: 'Standard',
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Payment Info Entered
The payment details were submitted. See the RudderStack reference.
From checkout_payment_info_submitted.
The fields of RudderStackContext, and:
| Field | Type | Present | |
|---|---|---|---|
checkout_id | string | always | The session id: the same on the cart, the checkout and the order. |
step | 3 | always | |
payment_method | string | optional | Credit Card for a card, else the API's code, such as paypal. |
rudderanalytics.track('Payment Info Entered', {
checkout_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
step: 3,
payment_method: 'Credit Card',
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Order Completed
An order was paid: the order, or one accepted upsell with its own order_id. See the RudderStack reference.
From checkout_completed, upsell_completed.
The fields of RudderStackContext, and:
| Field | Type | Present | |
|---|---|---|---|
checkout_id | string | always | The session id: the same on the cart, the checkout and the order. |
currency | string | always | ISO 4217, such as USD. |
order_id | string | always | The tracking event's event_id: the order number, or <ref_id>-US<n> for an upsell. |
affiliation | string | always | Online Store, or Upsell. |
subtotal | number | always | Σ price × quantity of products. |
revenue | number | always | The same as subtotal. |
total | number | always | subtotal + tax + shipping. |
shipping | number | always | |
tax | number | always | |
products | RudderStackProduct[] | always | |
discount | number | optional | |
coupon | string | optional |
rudderanalytics.track('Order Completed', {
checkout_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
order_id: '1001',
affiliation: 'Online Store',
subtotal: 89,
revenue: 89,
total: 106.11,
shipping: 9.99,
tax: 7.12,
currency: 'USD',
products: [
{
product_id: 'EB-2',
sku: 'EB-2',
name: 'Earbuds',
price: 44.5,
quantity: 2,
url: 'https://shop.test/checkout/',
position: 0,
category: 'Olympus',
brand: 'Olympus',
image_url: 'https://img.test/eb.png',
},
],
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Upsell Viewed
An upsell offer was shown. See the RudderStack reference.
From upsell_viewed.
The fields of RudderStackUpsell and RudderStackContext.
rudderanalytics.track('Upsell Viewed', {
order_id: 'R1',
product_id: 'page_view',
name: 'Upsell Page View',
quantity: 1,
currency: 'USD',
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Upsell Skipped
An upsell offer was skipped. See the RudderStack reference.
From upsell_skipped.
The fields of RudderStackUpsell and RudderStackContext.
rudderanalytics.track('Upsell Skipped', {
order_id: 'R1',
product_id: '3',
name: 'Earbuds case',
quantity: 1,
currency: 'USD',
page_type: 'product',
page_name: 'Olympus Earbuds',
campaign_name: 'Olympus',
campaign_api_key: 'pk_test',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_id: '1310',
campaign_session_id: '0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d',
});Types
RudderStackPageProperties
The page of a page() call and its <Page type> Page View track.
| Field | Type | Present | |
|---|---|---|---|
campaign_name | string | optional | |
campaign_api_key | string | optional | |
campaign_currency | string | optional | ISO 4217, such as USD. |
campaign_language | string | optional | |
campaign_id | string | optional | The campaign's id, as a string. |
campaign_session_id | string | optional | The tracking event's session_id. |
path | string | always | The page's path. |
url | string | always | The page, without its query string. |
title | string | always | |
referrer | string | always | Without the query string. |
RudderStackTraits
The shopper, as identify() takes them.
| Field | Type | Present | |
|---|---|---|---|
email | string | optional | |
firstName | string | optional | |
lastName | string | optional | |
phone | string | optional | |
city | string | optional | |
state | string | optional | The state or province code. |
country | string | optional | ISO 3166-1 alpha-2. |
postalCode | string | optional | |
acceptsMarketing | true | optional | Only when the shopper ticked the marketing checkbox. |
RudderStackProduct
One product, as the RudderStack ecommerce spec names its fields.
| Field | Type | Present | |
|---|---|---|---|
product_id | string | always | The product's id, else sku. |
sku | string | always | The product's SKU, else the package's external_id on a cart line and SKU-<product id> on an order line. |
name | string | always | |
price | number | always | What one unit costs; on an order, before tax unless the campaign's prices include it. |
quantity | number | always | |
url | string | always | The page, without its query string. |
category | string | optional | The campaign's name. |
brand | string | optional | On an order: the package's product name, else the campaign's name. |
variant | string | optional | |
position | number | always | Position in products, from 0. |
image_url | string | optional |
RudderStackContext
What every track call carries besides its own fields.
| Field | Type | Present | |
|---|---|---|---|
campaign_name | string | optional | |
campaign_api_key | string | optional | |
campaign_currency | string | optional | ISO 4217, such as USD. |
campaign_language | string | optional | |
campaign_id | string | optional | The campaign's id, as a string. |
campaign_session_id | string | optional | The tracking event's session_id. |
page_type | string | always | meta[name="next-page-type"], else nextConfig.pageType, else product. |
page_name | string | always | meta[name="next-page-name"], else the page's title. |
RudderStackUpsell
An upsell offer: the shown page, or the skipped package.
| Field | Type | |
|---|---|---|
order_id | string | The order the offer is for. |
product_id | string | page_view for a shown offer, else the package's ref_id. |
name | string | Upsell Page View for a shown offer, else the package's name. |
quantity | 1 | |
currency | string |