# WooCommerce

In order to integrate with WooCommerce one needs to place Offer18 Image Pixel in WooCommerce (WordPress). <br>

### [<mark style="color:blue;">Get Image Pixel</mark>](/network/postback-integration.md)

***

## WooCommerce Integration

There are two ways to add Offer18 Image Pixel to WooCommerce:-<br>

### Option 1 : WordPress Plugin

One can use WordPress plugin "WooCommerce Conversion Tracking" by weDevs.

Steps to follow:

1. Login to the WordPress Admin dashboard.
2. Go to "Plugins" and search "WooCommerce Conversion Tracking".\ <br>

   <div align="left"><figure><img src="/files/LSfifvKURa4nu2v4oORi" alt=""><figcaption><p><br></p></figcaption></figure></div>
3. Install and activate "WooCommerce Conversion Tracking" by weDevs.
4. Go to Conversion Tracking (sub-menu to the WooCommerce tab).
5. Enable "Custom" and Place Offer18 Pixel in "Successful Order."&#x20;

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

6. Go to Save Changes

One can receive dynamic values using tokens provided by the Plugin.\
For Example:  **\&sale** (Offer18) can be added to an Image pixel containing **{order\_subtotal}**

**Example Image pixel with sale parameter**

```
<img src="https://example.o18.click/p?mid=000&t=i&gb=1&sale={order_subtotal}" width="0" height="0"> 
```

***

Video Tutorial - WooCommerce Integration

{% embed url="<https://youtu.be/cayaPMkNzBk>" %}

***

### Option 2 : Custom Configuration

One can configure the **Conversion Tracking Syntax** in a custom configuration of the WordPress. Offer18's Conversion Tracking Syntax is given below.

#### **Conversion Tracking Syntax**

```php
add_action('woocommerce_thankyou', 'custom_track_o18');

function custom_track_o18($order_id)
{
  $order_data = wc_get_order($order_id);
  $total_amount = $order_data->get_subtotal();
  $currency = $order_data->get_currency();
  $order_number = str_replace('#', '', $order_data->get_order_number());
  echo '<img src="https://[domain]/p?m=[account_id]&t=i&gb=1&sale=' . $total_amount . '&adv_sub1=' . $order_number . '&currency='. $currency.'" width="0px" height="0px">';
}
```

{% hint style="info" %}
**Required Changes**\
\
Replace \[domain] with the tracking domain and \[account\_id] with the user account id in the script

For Example

\[domain] = **example.o18.click**\
\[account\_id]  = **0000**
{% endhint %}

Steps to follow

1. Login to the WordPress Admin dashboard.
2. Go to Appearance **»** Theme File Editor.
3. Open the **functions.php** file.
4. Place Offer18's Conversion Tracking Syntax in this file.

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

5. Go to "Update File."


---

# 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.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.
