view_item Event

The view_item event tracks when a user views a product detail page. This is a foundational event in ecommerce tracking, helping measure interest in specific products.

The view_item model

This model describes the product being viewed and relevant context.

Properties

  • Name
    event
    Type
    string
    Description

    Must be set to view_item.

  • Name
    user_id
    Type
    string
    Description

    Unique ID for the user viewing the item.

  • Name
    session_id
    Type
    string
    Description

    ID of the current session.

  • Name
    ecommerce.currency
    Type
    string
    Description

    ISO 4217 currency code (e.g., USD).

  • Name
    ecommerce.value
    Type
    float
    Description

    Product value (price - discount).

  • Name
    ecommerce.items
    Type
    array
    Description

    Array of item objects (typically one for this event).

  • Name
    ecommerce.items[].item_id
    Type
    string
    Description

    SKU or product ID.

  • Name
    ecommerce.items[].item_name
    Type
    string
    Description

    Product name.

  • Name
    ecommerce.items[].item_brand
    Type
    string
    Description

    Brand name.

  • Name
    ecommerce.items[].item_category
    Type
    string
    Description

    Main category.

  • Name
    ecommerce.items[].item_variant
    Type
    string
    Description

    Variant name (e.g., color, size).

  • Name
    ecommerce.items[].price
    Type
    float
    Description

    Product price.

  • Name
    ecommerce.items[].discount
    Type
    float
    Description

    Discount amount.


Push event to the dataLayer

dataLayer.push example

dataLayer.push({
  event: 'view_item',
  user_id: 'user-456',
  session_id: 'session-789',
  ecommerce: {
    currency: 'USD',
    value: 29.99,
    items: [
      {
        item_id: 'SKU-202',
        item_name: 'Minimalist Desk Lamp',
        item_brand: 'Brightify',
        item_category: 'Home Office',
        item_variant: 'Matte White',
        price: 39.99,
        discount: 10.00
      }
    ]
  }
});

Best Practices

  • Fire this event only on the product detail view.
  • Ensure all product metadata matches catalog data.
  • Keep consistent structure with other ecommerce events like add_to_cart.

Use Cases

The view_item event supports:

  • Product-level analytics and impressions
  • Retargeting and audience building
  • Funnel and interest scoring
  • Dynamic ad optimization

Was this page helpful?