# WooCommerce

Чтобы интегрироваться с WooCommerce, необходимо разместить пиксель Offer18 Image Pixel в WooCommerce (WordPress). <br>

### [<mark style="color:синий;">Получить Image Pixel</mark>](/ru/set/integraciya-postbekov.md)

***

## Интеграция с WooCommerce

Существует два способа добавить Offer18 Image Pixel в WooCommerce: -<br>

### Вариант 1 : Плагин WordPress

Можно использовать плагин WordPress "WooCommerce Conversion Tracking" от weDevs.

Шаги для выполнения:

1. Войдите в панель администратора WordPress.
2. Перейдите в «Плагины» и найдите «WooCommerce Conversion Tracking».\ <br>

   <div align="left"><figure><img src="/files/4736c5c2b3a8912d4ae2abf958313ebf66a7a2e3" alt=""><figcaption><p><br></p></figcaption></figure></div>
3. Установите и активируйте «WooCommerce Conversion Tracking» от weDevs.
4. Перейдите в Conversion Tracking (подменю вкладки WooCommerce).
5. Включите «Custom» и вставьте пиксель Offer18 в «Successful Order».&#x20;

<figure><img src="/files/777b09b0d6168de2bddb002ff6bb72ab40a26f86" alt=""><figcaption></figcaption></figure>

6. Перейдите к Сохранить изменения

Можно получить динамические значения, используя токены, предоставляемые плагином.\
Например:  **\&sale** (Offer18) можно добавить в Image pixel, содержащий **{order\_subtotal}**

**Пример Image pixel с параметром sale**

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

***

Видеоурок - интеграция с WooCommerce

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

***

### Вариант 2 : Пользовательская настройка

Можно настроить **Синтаксис отслеживания конверсий** в пользовательской конфигурации WordPress. Синтаксис отслеживания конверсий Offer18 приведён ниже.

#### **Синтаксис отслеживания конверсий**

```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" %}
**Требуемые изменения**\
\
Замените \[domain] на домен отслеживания и \[account\_id] на идентификатор учетной записи пользователя в скрипте

Например

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

Шаги для выполнения

1. Войдите в панель администратора WordPress.
2. Перейдите в Внешний вид **»** Редактор файлов темы.
3. Откройте **functions.php** файл.
4. Разместите синтаксис отслеживания конверсий Offer18 в этом файле.

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

5. Перейдите к «Обновить файл.»


---

# 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/ru/set/integraciya-elektronnoi-kommercii/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.
