# Google Tag Manager.

> Source: https://docs.gifty.nl/en/order-widget/installation/google-tag-manager
> Language: en

<a id="section"></a>

### 

The GTM integration sends a purchase event into your Tag Manager container. From GTM, you can forward this event to Google Analytics, Google Ads, or other third-party tracking tools.

---

<a id="installation"></a>

## Installation

To enable GTM purchase tracking, add the gtag property to your Gifty script.

```html
<script>
window.Gifty = {
  key: 'WIDGET_KEY_HERE',
  gtag: true
};
(function (e, t) {
	var n = e.createElement(t);
	n.async = true;
	n.src = 'https://static.gifty.nl/js/widget.js';
	var r = e.getElementsByTagName(t)[0];
	r.parentNode.insertBefore(n, r);
})(document, 'script');
</script>
```

---

<a id="event-data"></a>

## Event data

On order completion, we push a **purchase** event to GTM with data of the order. For example:

```javascript
gtag("event", "purchase", {
  transaction_id: "or_E04koXGzj8dl92nb1ywQZgx5",
  value: 185,
  tax: 0.00,
  shipping: 0.00,
  currency: "EUR",
  items: [
    {
      item_id: "gifty-gift-card",
      item_name: "Gifty Gift Card",
      item_variant: "Package: Gifty hoodie (1)",
      price: 35,
      quantity: 1
    },
    {
      item_id: "gifty-gift-card",
      item_name: "Gifty Gift Card",
      item_variant: "Value: 7500",
      price: 75,
      quantity: 2
    }
  ]
});
```

In this event, the following data is present.

| Field | Description |
| --- | --- |
| transaction_id | Unique Gifty order ID |
| value | Total value of all gift cards in the order. Note that additional items like wrappings and shipping are excluded on purpose, as this does not count towards your revenue. |
| currency | Currency of the order (for example EUR) |
| items | All gift cards in the order |
