---
title: "Acquisition Tagging - dataLayer"
url: "https://help.webeyez.com/en/article/acquisition-tagging"
language: "en"
last_updated: "2025-08-25T15:00:00.297Z"
---

# Acquisition Tagging - dataLayer

To track eCommerce events like Add to Cart, View Cart, and Purchase effectively using a dataLayer, you need to follow eCommerce standards. This will allow seamless integration with tools like Webeyez, Google Tag Manager (GTM), Google Analytics 4 (GA4), and other marketing/analytics platforms.

Here’s a step-by-step guide to tagging your site’s dataLayer for these three key events:

## **Add to Cart Event - add\_to\_cart**

  
Trigger this event when a user clicks “Add to Cart”:  
**Event name must be exactly “add\_to\_cart” for Webeyez to recognize it.**  
 

```javascript
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: "add_to_cart",
  ecommerce: {
    currency: "USD",
    value: 29.99,
    items: [{
      item_id: "SKU123",
      item_name: "Red Sneakers",
      affiliation: "Online Store",
      index: 1,
      item_brand: "YourBrand",
      item_category: "Footwear",
      item_variant: "Red",
      price: 29.99,
      quantity: 1
    }]
  }
});
</script>
```

## **View Cart Event - View\_cart**

Fire this on the cart page load:  
**Event name must be exactly “view\_cart” for Webeyez to recognize it.**

```javascript
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: "view_cart",
  ecommerce: {
    currency: "USD",
    value: 89.97,
    items: [
      {
        item_id: "SKU123",
        item_name: "Red Sneakers",
        price: 29.99,
        quantity: 1
      },
      {
        item_id: "SKU456",
        item_name: "Blue T-shirt",
        price: 19.99,
        quantity: 2
      }
    ]
  }
});
</script>
```

**Best Practice**:

This should match the actual cart content, ideally rendered server-side or via your app’s cart object.  
  
 

## **Purchase - Completed Purchase Event**

Fire this **on the thank-you/confirmation page** only after a successful payment:  
**Event name must be exactly “purchase” for Webeyez to recognize it.**

```javascript
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: "purchase",
  ecommerce: {
    transaction_id: "T987654",
    affiliation: "Online Store",
    currency: "USD",
    value: 109.97,
    tax: 8.00,
    shipping: 5.00,
    coupon: "SUMMER10",
    items: [
      {
        item_id: "SKU123",
        item_name: "Red Sneakers",
        price: 29.99,
        quantity: 1
      },
      {
        item_id: "SKU456",
        item_name: "Blue T-shirt",
        price: 19.99,
        quantity: 2
      }
    ]
  }
});
</script>
```

**Best Practice**:

-   Always include a **unique transaction\_id** to avoid double-counting.

This should only trigger **after** payment is confirmed.
