# WooCommerce

Para integrar com o WooCommerce é necessário inserir o Pixel de Imagem Offer18 no WooCommerce (WordPress). <br>

### [<mark style="color:azul;">Obter Pixel de Imagem</mark>](/pt/rede/integracao-de-postback.md)

***

## Integração com WooCommerce

Existem duas maneiras de adicionar o Pixel de Imagem Offer18 ao WooCommerce:-<br>

### Opção 1 : Plugin do WordPress

Pode-se usar o plugin do WordPress "WooCommerce Conversion Tracking" da weDevs.

Passos a seguir:

1. Faça login no painel administrativo do WordPress.
2. Vá em "Plugins" e pesquise "WooCommerce Conversion Tracking".\ <br>

   <div align="left"><figure><img src="/files/4f0b35c91c9ac0fd423b00d39e8cb4e943ddb47e" alt=""><figcaption><p><br></p></figcaption></figure></div>
3. Instale e ative "WooCommerce Conversion Tracking" da weDevs.
4. Vá para Conversion Tracking (submenu da aba WooCommerce).
5. Habilite "Custom" e coloque o Pixel Offer18 em "Successful Order."&#x20;

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

6. Vá em Salvar Alterações

Pode-se receber valores dinâmicos usando tokens fornecidos pelo Plugin.\
Por exemplo:  **\&sale** (Offer18) pode ser adicionado a um pixel de imagem contendo **{order\_subtotal}**

**Exemplo de pixel de imagem com parâmetro sale**

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

***

Tutorial em vídeo - Integração com WooCommerce

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

***

### Opção 2 : Configuração Personalizada

Pode-se configurar o **Conversion Tracking Syntax** em uma configuração personalizada do WordPress. A Conversion Tracking Syntax da Offer18 é fornecida abaixo.

#### **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" %}
**Alterações Necessárias**\
\
Substitua \[domain] pelo domínio de rastreamento e \[account\_id] pelo id da conta do usuário no script

Por exemplo

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

Passos a seguir

1. Faça login no painel administrativo do WordPress.
2. Vá para Aparência **»** Editor de Arquivos do Tema.
3. Abra o **functions.php** arquivo.
4. Coloque a Conversion Tracking Syntax da Offer18 neste arquivo.

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

5. Vá em "Atualizar Arquivo."


---

# 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/pt/rede/integracao-de-e-commerce/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.
