> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kameleoon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a goal conversion from GTM

> Create Kameleoon goal conversion tags in Google Tag Manager to track events, revenue, and metadata without modifying your site's code directly.

If you manage your site's tracking through Google Tag Manager, you can fire Kameleoon goal conversions directly from GTM tags, without modifying your site's code. This is useful when your development workflow runs through GTM, or when you want to keep all conversion tracking centralized in one place. This article covers how to create a basic conversion tag, a tag that records revenue, and a tag that passes metadata alongside the conversion.

## Create a tag

1. Click **New**.
2. Name your tag (for example, "Kameleoon - add to cart", "Kameleoon - transaction").
3. Select **Custom HTML** in **Tag Configuration**, and insert this code:

```javascript theme={null}
<script>
  kameleoonGoal = 123456; 
  window.kameleoonQueue = window.kameleoonQueue || [];
  kameleoonQueue.push(['Goals.processConversion', kameleoonGoal]);
</script>;
```

* You must replace `123456` with the Kameleoon goal ID.

4. Select an existing trigger or create a new one (depending on the `dataLayer` format).

## Create a tag with revenue

To create a tag with revenue:

1. Click **New**.
2. Name your tag.
3. Select **Custom HTML** in **Tag Configuration**, and insert this code:

```javascript theme={null}
<script>
  kameleoonGoal = 123456; 
  window.kameleoonQueue = window.kameleoonQueue || [];
  kameleoonQueue.push(['Goals.processConversion', kameleoonGoal, {{ TransactionRevenue }}]);
</script>
```

`123456` is the Kameleoon goal ID, and `{{TransactionRevenue}}` is a variable with revenue attached to the conversion.

4. Select an existing trigger or create a new one (depending on the `dataLayer` format).

## Create a tag with metadata

The example below adds a payment method and order ID as metadata to the goal conversion. To create a tag with metadata:

1. Click **New**.
2. Name your tag.
3. Select **Custom HTML** in **Tag Configuration**, and insert this code:

```javascript theme={null}
<script>
kameleoonGoal = 123456; 
window.kameleoonQueue = window.kameleoonQueue || [];
kameleoonQueue.push(['Kameleoon.API.Goals.processConversion', 
                     kameleoonGoal, 
                     {{ TransactionRevenue }}, //revenue (if empty put 0)
                     {
                         0: {{ paymentMethod }},  //custom data index and associated value
                         1: {{ oderID }} //custom data index and associated value
                     }]);
</script>
```

* **`123456`** is the Kameleoon goal ID.
* **`{{ TransactionRevenue }}`** is a variable with revenue attached to the conversion.
* **`{{ paymentMethod}}`** is a variable with the payment method attached to the conversion, and **`0`** is the index of the custom data where the variable will be added.
* **`{{ orderID }}`** is a variable with the order ID attached to the conversion, and **`1`** is the index of the custom data where the variable will be added.

4. Select an existing trigger or create a new one (depending on the `dataLayer` format).
