GTM

Pushes each tracking event to window.dataLayer and window.NextDataLayer in the 0.4.x format, for GTM containers and forwarders built on it. The format is deprecated, and still sent; new code listens with next.analytics.on. Vendor docs: Elevar data layer.

Config

On by default. Off, pushes still reach window.NextDataLayer but not window.dataLayer:

CODE
<script>
  window.nextConfig = {
    analytics: {
      destinations: { gtm: { enabled: false } },
    },
  };
</script>

The 0.4.x analytics.providers.gtm.enabled: false does the same.

What loads

Nothing of its own: the analytics chunk pushes. The SDK never loads GTM: the container is the page's own tag.

Events

dl_add_to_cart and dl_remove_from_cart are pushed once per burst of lines, where product_added_to_cart comes once per line; dl_add_shipping_info once per checkout, for the first of its two tracking events; dl_purchase once per order, once it is paid.

Where pushes go

  1. window.NextDataLayerTransformFn(event), when the page defines it, gets each push first and returns the push to send. A falsy return drops it; an error logs and drops it.
  2. The push goes to window.NextDataLayer.
  3. Then to window.dataLayer, after { ecommerce: null } so GTM clears the previous ecommerce object.

A container built on the tracking names instead pushes them from a listener, with { ecommerce: null } first when it sends an ecommerce object. Turn the dl_* pushes off then, or the container gets each event twice:

CODE
next.analytics.on('*', ({ event_type, event_id, data }) => {
  window.dataLayer.push({ event: event_type, event_id, ...data });
});

The exit-intent popup of next.exitIntent() pushes dl_view_promotion and dl_select_promotion like any promotion, and the five dl_exit_intent_* pushes below, which have no tracking event. A close after a click, or the page removing the popup, sends neither _dismissed nor _closed.

Every push carries the fields of DataLayerPush. The examples show them on dl_user_data; the others leave them out but event and event_id.

dl_user_data

Every page load, with the cart. See the Elevar reference.

From page_viewed.

The fields of DataLayerPush, and:

FieldType
cart_totalstringThe cart's total, as the API priced it.
ecommerceDataLayerEcommerce
CODE
{
  "event": "dl_user_data",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "event_time": "2026-11-04T08:30:00.000Z",
  "user_properties": {
    "visitor_type": "guest"
  },
  "page_location": "http://localhost:3000/",
  "page_title": "Olympus Earbuds",
  "page_referrer": "",
  "campaign_id": "1310",
  "campaign_name": "Olympus",
  "campaign_currency": "USD",
  "campaign_language": "en",
  "campaign_api_key": "pk_test",
  "campaign_session_id": "0b8f3c2d1e4a4f6b9c7d5e3f2a1b0c9d",
  "attribution": {
    "funnel": "Olympus",
    "metadata": {
      "landing_page": "",
      "referrer": "",
      "device": "",
      "device_type": "desktop",
      "fb_fbp": "",
      "fb_fbc": "",
      "domain": "",
      "fb_pixel_id": "",
      "sdk_version": "1.0.0",
      "conversion_timestamp": 1793781000000
    }
  },
  "_metadata": {
    "source": "NextDataLayer",
    "version": "1.0.0"
  },
  "cart_total": "0",
  "ecommerce": {
    "currency": "USD",
    "value": 0,
    "items": []
  }
}

dl_view_item

The page shows one package. See the Elevar reference.

From product_viewed.

The fields of DataLayerPush, and:

FieldType
ecommerceDataLayerEcommerce
CODE
{
  "event": "dl_view_item",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "ecommerce": {
    "currency": "USD",
    "value": 49,
    "items": [
      {
        "item_id": "11",
        "item_name": "Earbuds ×1",
        "item_category": "Olympus",
        "item_product_id": "400",
        "item_image": "https://cdn.test/1.png",
        "price": 49,
        "discount": 50,
        "quantity": 1,
        "currency": "USD",
        "index": 0
      }
    ]
  }
}

dl_view_item_list

The page shows more than one package. See the Elevar reference.

From product_list_viewed.

The fields of DataLayerPush, and:

FieldType
ecommerceOmit<DataLayerEcommerce, "value"> & { item_list_id: "product_list"; item_list_name: "Product List" }
CODE
{
  "event": "dl_view_item_list",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "ecommerce": {
    "currency": "USD",
    "items": [
      {
        "item_id": "11",
        "item_name": "Earbuds ×1",
        "item_category": "Olympus",
        "item_product_id": "400",
        "item_image": "https://cdn.test/1.png",
        "price": 49,
        "discount": 50,
        "quantity": 1,
        "currency": "USD",
        "index": 0
      },
      {
        "item_id": "12",
        "item_name": "Earbuds ×2",
        "item_category": "Olympus",
        "item_product_id": "400",
        "item_image": "https://cdn.test/2.png",
        "price": 44.5,
        "discount": 54.5,
        "quantity": 2,
        "currency": "USD",
        "index": 1
      }
    ],
    "item_list_id": "product_list",
    "item_list_name": "Product List"
  }
}

dl_add_to_cart

Lines added to the cart, one push per burst. See the Elevar reference.

From product_added_to_cart.

The fields of DataLayerPush, and:

FieldType
ecommerceDataLayerEcommerce
first_in_sessionbooleanNo package was added in this tab before.
CODE
{
  "event": "dl_add_to_cart",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "ecommerce": {
    "currency": "USD",
    "value": 49,
    "items": [
      {
        "item_id": "11",
        "item_name": "Earbuds ×1",
        "item_category": "Olympus",
        "item_product_id": "400",
        "item_image": "https://cdn.test/1.png",
        "price": 49,
        "discount": 50,
        "quantity": 1,
        "currency": "USD",
        "index": 0
      }
    ]
  },
  "first_in_session": true
}

dl_remove_from_cart

Lines removed from the cart, one push per burst. See the Elevar reference.

From product_removed_from_cart.

The fields of DataLayerPush, and:

FieldType
ecommerceDataLayerEcommerce
CODE
{
  "event": "dl_remove_from_cart",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "ecommerce": {
    "currency": "USD",
    "value": 49,
    "items": [
      {
        "item_id": "11",
        "item_name": "Earbuds ×1",
        "item_category": "Olympus",
        "item_product_id": "400",
        "item_image": "https://cdn.test/1.png",
        "price": 49,
        "discount": 50,
        "quantity": 1,
        "currency": "USD",
        "index": 0
      }
    ]
  }
}

dl_cart_updated

The cart after a price update. Not an Elevar event. See the Elevar reference.

From cart_updated.

The fields of DataLayerPush, and:

FieldType
cart_totalstring
ecommerceDataLayerEcommerce
cartobjectThe 0.4.x cart summary.
cart.currencystring
cart.items{ package_id: number; quantity: number; price: number }[]
cart.items[].package_idnumber
cart.items[].quantitynumber
cart.items[].pricenumber
cart.total_itemsnumberΣ quantity.
cart.total_valuenumberΣ price × quantity.
CODE
{
  "event": "dl_cart_updated",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "cart_total": "49.00",
  "ecommerce": {
    "currency": "USD",
    "value": 49,
    "items": [
      {
        "item_id": "11",
        "item_name": "Earbuds ×1",
        "item_category": "Olympus",
        "item_product_id": "400",
        "item_image": "https://cdn.test/1.png",
        "price": 49,
        "discount": 50,
        "quantity": 1,
        "currency": "USD",
        "index": 0
      }
    ],
    "shipping": 0
  },
  "cart": {
    "currency": "USD",
    "items": [
      {
        "package_id": 1,
        "quantity": 1,
        "price": 49
      }
    ],
    "total_items": 1,
    "total_value": 49
  }
}

dl_begin_checkout

The checkout started. See the Elevar reference.

From checkout_started.

The fields of DataLayerPush, and:

FieldType
cart_totalstring
ecommerceDataLayerEcommerce
CODE
{
  "event": "dl_begin_checkout",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "cart_total": "49.00",
  "ecommerce": {
    "currency": "USD",
    "value": 49,
    "items": [
      {
        "item_id": "11",
        "item_name": "Earbuds ×1",
        "item_category": "Olympus",
        "item_product_id": "400",
        "item_image": "https://cdn.test/1.png",
        "price": 49,
        "discount": 50,
        "quantity": 1,
        "currency": "USD",
        "index": 0
      }
    ],
    "shipping": 0
  }
}

dl_generate_lead

The contact details saved an Open Cart. Not an Elevar event. See the Elevar reference.

From checkout_contact_info_submitted.

The fields of DataLayerPush, and:

FieldType
currencystring
valuenumber
lead_source"checkout"
CODE
{
  "event": "dl_generate_lead",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "currency": "USD",
  "value": 49,
  "lead_source": "checkout"
}

dl_add_shipping_info

Once per checkout: the first of a valid shipping address and a picked shipping method. See the Elevar reference.

From checkout_shipping_address_submitted, checkout_shipping_method_submitted.

The fields of DataLayerPush, and:

FieldType
ecommerceDataLayerEcommerce & { currencyCode: string; shipping_tier: string }
event_category"ecommerce"
event_valuenumberThe cart's total.
shipping_tierstringThe shipping method's name, else Standard.
CODE
{
  "event": "dl_add_shipping_info",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "ecommerce": {
    "currency": "USD",
    "value": 49,
    "items": [
      {
        "item_id": "11",
        "item_name": "Earbuds ×1",
        "item_category": "Olympus",
        "item_product_id": "400",
        "item_image": "https://cdn.test/1.png",
        "price": 49,
        "discount": 50,
        "quantity": 1,
        "currency": "USD",
        "index": 0
      }
    ],
    "shipping": 0,
    "currencyCode": "USD",
    "shipping_tier": "Standard"
  },
  "event_category": "ecommerce",
  "event_value": 49,
  "shipping_tier": "Standard"
}

dl_add_payment_info

A checkout submit passed its checks. See the Elevar reference.

From checkout_payment_info_submitted.

The fields of DataLayerPush, and:

FieldTypePresent
ecommerceDataLayerEcommerce & { payment_type?: string }always
event_category"ecommerce"always
event_valuenumberalwaysThe cart's total.
payment_typestringoptionalCredit Card for a card, else the payment method; none before one is picked.
CODE
{
  "event": "dl_add_payment_info",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "ecommerce": {
    "currency": "USD",
    "value": 49,
    "items": [
      {
        "item_id": "11",
        "item_name": "Earbuds ×1",
        "item_category": "Olympus",
        "item_product_id": "400",
        "item_image": "https://cdn.test/1.png",
        "price": 49,
        "discount": 50,
        "quantity": 1,
        "currency": "USD",
        "index": 0
      }
    ],
    "shipping": 0,
    "payment_type": "Credit Card"
  },
  "event_category": "ecommerce",
  "event_value": 49,
  "payment_type": "Credit Card"
}

dl_purchase

An order was paid, without its upsells. See the Elevar reference.

From checkout_completed.

The fields of DataLayerPush, and:

FieldType
pageType"purchase"
ecommerceDataLayerPurchase
CODE
{
  "event": "dl_purchase",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "pageType": "purchase",
  "ecommerce": {
    "currency": "USD",
    "transaction_id": "1001",
    "value": 89,
    "tax": 7.12,
    "shipping": 9.99,
    "affiliation": "Online Store",
    "items": [
      {
        "item_id": "EB-2",
        "item_name": "Earbuds",
        "item_brand": "Olympus",
        "item_category": "Olympus",
        "item_sku": "EB-2",
        "item_image": "https://img.test/eb.png",
        "price": 44.5,
        "quantity": 2,
        "currency": "USD",
        "index": 0
      }
    ]
  }
}

dl_upsell_purchase

One upsell was accepted. Not an Elevar event. See the Elevar reference.

From upsell_completed.

The fields of DataLayerPush, and:

FieldType
pageType"upsell"
ecommerceDataLayerPurchase
upsell_metadataobject
upsell_metadata.original_order_idstringThe order's ref_id.
upsell_metadata.upsell_numbernumber1 for the first upsell on the order.
upsell_metadata.package_idstring
upsell_metadata.package_namestring
CODE
{
  "event": "dl_upsell_purchase",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "pageType": "upsell",
  "ecommerce": {
    "currency": "USD",
    "transaction_id": "R1-US1",
    "value": 20,
    "tax": 0,
    "shipping": 0,
    "affiliation": "Upsell",
    "items": [
      {
        "item_id": "SKU-99",
        "item_name": "Bump",
        "item_brand": "Olympus",
        "item_category": "Olympus",
        "price": 20,
        "quantity": 1,
        "currency": "USD",
        "index": 0
      }
    ]
  },
  "upsell_metadata": {
    "original_order_id": "R1",
    "upsell_number": 1,
    "package_id": "99",
    "package_name": "Bump"
  }
}

dl_viewed_upsell

An upsell page showed an offer. Not an Elevar event. See the Elevar reference.

From upsell_viewed.

The fields of DataLayerPush, and:

FieldType
order_idstringThe order's ref_id.
page_pathstring
upsellobject
upsell.package_id"page_view"
upsell.package_name"Upsell Page View"
upsell.currencystring
CODE
{
  "event": "dl_viewed_upsell",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "order_id": "R1",
  "page_path": "/upsell/",
  "upsell": {
    "package_id": "page_view",
    "package_name": "Upsell Page View",
    "currency": "USD"
  }
}

dl_skipped_upsell

An upsell was skipped. Not an Elevar event. See the Elevar reference.

From upsell_skipped.

The fields of DataLayerPush, and:

FieldType
order_idstringThe order's ref_id.
upsellobjectThe first package offered; unknown when there was none.
upsell.package_idstring
upsell.package_namestring
CODE
{
  "event": "dl_skipped_upsell",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "order_id": "R1",
  "upsell": {
    "package_id": "3",
    "package_name": "Earbuds case"
  }
}

dl_view_promotion

A promotion was shown. Not an Elevar event. See the Elevar reference.

From promotion_viewed.

The fields of DataLayerPush, and:

FieldType
ecommerceDataLayerPromotion
CODE
{
  "event": "dl_view_promotion",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "ecommerce": {
    "promotion_id": "exit_intent",
    "promotion_name": "Exit offer",
    "creative_name": "exit-offer"
  }
}

dl_select_promotion

A promotion was clicked. Not an Elevar event. See the Elevar reference.

From promotion_selected.

The fields of DataLayerPush, and:

FieldType
ecommerceDataLayerPromotion
CODE
{
  "event": "dl_select_promotion",
  "event_id": "3f2b8c1d9e7a4b6c8d5e2f1a0b9c8d7e",
  "ecommerce": {
    "promotion_id": "exit_intent",
    "promotion_name": "Exit offer",
    "creative_name": "exit-offer"
  }
}

dl_exit_intent_shown

The exit-intent popup opened. It has no tracking event. See the Elevar reference.

The fields of DataLayerPush and DataLayerExitIntent, and:

FieldType
exit_intentDataLayerPopup

dl_exit_intent_accepted

The exit-intent popup's image was clicked. It has no tracking event. See the Elevar reference.

The fields of DataLayerPush and DataLayerExitIntent, and:

FieldType
exit_intentDataLayerPopup

dl_exit_intent_action

A close or apply-coupon button of the exit-intent popup, or a custom action once it has run. It has no tracking event. See the Elevar reference.

The fields of DataLayerPush and DataLayerExitIntent, and:

FieldType
exit_intentobjectclose, apply-coupon or custom, with the code an apply-coupon button applied.
exit_intent.actionstring
exit_intent.coupon_codestring

dl_exit_intent_dismissed

Esc or the overlay closed the exit-intent popup. It has no tracking event. See the Elevar reference.

The fields of DataLayerPush and DataLayerExitIntent, and:

FieldType
exit_intentDataLayerPopup

dl_exit_intent_closed

The exit-intent popup's × button closed it. It has no tracking event. See the Elevar reference.

The fields of DataLayerPush and DataLayerExitIntent, and:

FieldType
exit_intentDataLayerPopup

Types

DataLayerPush

The fields every dl_* push carries, in the 0.4.x Elevar format.

FieldTypePresent
eventstringalwaysThe dl_* name.
event_idstringalwaysThe tracking event's event_id; the transaction id on dl_purchase and dl_upsell_purchase.
event_timestringalwaysIts ISO time.
user_propertiesobjectalwaysIn the Elevar format.
user_properties.visitor_type"guest"always
page_locationstringalwaysThe page, without the query string.
page_titlestringalways
page_referrerstringalways
campaign_idstringoptionalThe campaign, at the top level as 0.4.30 sent it.
campaign_namestringoptional
campaign_currencystringoptionalISO 4217, such as USD.
campaign_languagestringoptional
campaign_api_keystringalwaysThe campaign's public API key.
campaign_session_idstringalways
attributionAttributionalwaysUTM parameters, affiliate and click ids, landing page; URLs in metadata without their query string.
_metadataobjectalways
_metadata.source"NextDataLayer"always
_metadata.versionstringalways

DataLayerEcommerce

A push's ecommerce, GA4-style.

FieldTypePresent
currencystringalwaysISO 4217, such as USD.
valuenumberalwaysΣ price × quantity of items.
itemsDataLayerItem[]always
couponstringoptionalThe first code on the cart.
shippingnumberoptionalThe shipping method's price, once one is picked.

DataLayerPurchase

A paid order, or one accepted upsell, as ecommerce.

FieldTypePresent
currencystringalways
transaction_idstringalwaysThe push's event_id.
valuenumberalwaysΣ price × quantity of items.
taxnumberalways0 on an upsell.
shippingnumberalways0 on an upsell.
affiliation"Upsell" | "Online Store"always
itemsDataLayerItem[]alwaysThe order's lines without its upsells, or the upsell's one line.
couponstringoptionalThe code the order was placed with.
discountnumberoptionalThe order's total discount, when above 0.

DataLayerPromotion

A promotion push's ecommerce.

FieldTypePresent
promotion_idstringalways
promotion_namestringoptional
creative_namestringoptional

DataLayerExitIntent

The fields of an exit-intent popup's push.

FieldType
event_category"engagement"
event_actionstringexit_intent_<moment>, or exit_intent_<button action> on dl_exit_intent_action.
event_labelstringThe popup's image URL, else its template; the coupon code or button action on dl_exit_intent_action.

DataLayerPopup

An exit-intent popup, as its pushes describe it.

FieldType
image_urlstringIts image URL, else empty.
templatestringIts template, else empty.

DataLayerItem

One product of a push's ecommerce.items, GA4-style.

FieldTypePresent
item_idstringalwaysThe SKU, else the package's external id; SKU-<product id> on an order line without one.
item_namestringalways
item_brandstringoptionalThe product name, else the campaign name; order lines only.
item_categorystringoptionalThe campaign name.
item_variantstringoptional
item_product_idstringoptional
item_variant_idstringoptional
item_skustringoptional
item_imagestringoptional
pricenumberalwaysWhat one unit costs, after discounts.
discountnumberoptionalThe discount on one unit, when there is one.
quantitynumberalwaysIn units: a package of 2 added once is 2.
currencystringalwaysISO 4217, such as USD.
indexnumberalwaysPosition in items, from 0.