# WooCommerce

### Step 1 : Create Offer

For Cookieless tracking, it is mandatory to include click ID parameter and token in the Offer URL and also for all the landing pages while creating an offer in Offer18 dashboard.

{% code title="Example" overflow="wrap" %}

```
https://shopurl.com/?<YOUR-CLICK-ID-PARAMETER>={tid}
```

{% endcode %}

***

### Step 2 : Install plugins

1. "WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager" by WPCode
2. "WooCommerce Conversion Tracking" by weDevs

#### Steps to follow

1. Login to the WordPress Admin dashboard.
2. Go to "Plugins" and search "WooCommerce Conversion Tracking" & "WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager".

<figure><img src="/files/JSThxRdVhE8roW5Uswaa" alt=""><figcaption></figcaption></figure>

3. Install and activate "WooCommerce Conversion Tracking" & "WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager".

***

### Step 3 : Code Placement

1. Go to Code Script **»** Header & Footer
2. Place the below code in "Scripts in header" field
3. Save settings

```html
<script src="https://web-resources.offer18.net/sdk/web/WebSDK.js"></script>
<script>
    window.Offer18WebSDK.initializeConversion('<YOUR-CLICK-ID-PARAMETER>');
</script>
```

<figure><img src="/files/a9PZd2tX3v1fGtHP0BYw" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Users must replace '\<YOUR-CLICK-ID-PARAMETER>' with the clickid parameter used when creating the offer.
{% endhint %}

***

### Step 4 : Place below script in Conversion Tracking

1. Go to Conversion Tracking (sub-menu to the WooCommerce tab).
2. Enable "Custom" and Place below code in "Successful Order."
3. Save Changes

```html
<script>
    window.Offer18WebSDK.trackConversion({
        domain: '',
        accountId: '',
        offerId: '',
        coupon: '', 
        postbackType: '', // 'iframe' or 'pixel'
        isGlobalPixel: false, // true or false
        allowMultiConversion: false, // true or false
        conversionData: {
            event: '', // Event Name (Please specify the event)
            payout: '', // Payout Amount (Please specify the payout amount)
            sale: '', // Sale Amount (Please specify the sale amount)
            currency: '',
            adv_sub1: '',
            adv_sub2: '',
            adv_sub3: '',
            adv_sub4: '',
            adv_sub5: '',
        }
    })
</script>
```

<figure><img src="/files/CSLlsMNhBcIq8kBS0kBb" alt=""><figcaption></figcaption></figure>

***

You can collect conversion data using various Offer18 Postback Parameters and WooCommerce data attributes.

| **Offer18 Postback Parameter** | **WooCommerce Parameter** |
| ------------------------------ | ------------------------- |
| sale                           | {order\_subtotal}         |
| adv\_sub4                      | {order\_number}           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://knowledgebase.offer18.com/network/e-commerce-integration/woocommerce-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
