> For the complete documentation index, see [llms.txt](https://knowledgebase.offer18.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.offer18.com/ru/set/sdk/avtomaticheskii-trigger.md).

# Автоматический триггер

Эта функция позволяет управлять несколькими действиями отслеживания через одну конфигурацию. На основе предопределенных условий, таких как совпадающие пути сайта, имена хостов или источники переходов, SDK автоматически запускает соответствующие функции.

С таким подходом поведение отслеживания можно контролировать и настраивать без повторной настройки, что упрощает управление и масштабирование отслеживания в разных сценариях.&#x20;

### Начать

Чтобы начать автоматическое отслеживание с веб-SDK Offer18, необходимо добавить тег script на сайт.

<mark style="color:пурпурный;">Размещение : Заголовок (Все страницы)</mark>

{% code fullWidth="false" %}

```html
<script src="https://web-resources.offer18.net/sdk/web/WebSDK.js"></script>
```

{% endcode %}

***

### Отслеживание клика&#x20;

Чтобы отслеживать клики с помощью автоматического скрипта SDK, добавьте следующий код на свой сайт.

<mark style="color:пурпурный;">Размещение : Заголовок (Все страницы)</mark>

{% code overflow="wrap" %}

```html
<script>
	window.Offer18SDK.init({
		automatedTrigger: true,
		opeations: [{
			triggerFunction: "trackClick",
			triggerconditios: [
				{
					mode: "<condition-mode>", // contain or equal
					type: "<condition-type>", // path / hostname / referral
					value: "<condition-value>"
				}
			],
			triggerConfig: {
				trackingURL: "https://example.com?c/o=xxx&m=000&a=000",
				keymapping: ['<OFFER18-PARAMETER>:<YOUR-PARAMETER>', '<OFFER18-PARAMETER>:<YOUR-PARAMETER>', ...]
			}
		}]
	})
</script>
```

{% endcode %}

***

### Отслеживание показов

Чтобы отслеживать показы с помощью автоматического скрипта SDK, добавьте следующий код на свой сайт.

<mark style="color:пурпурный;">Размещение : Заголовок (Все страницы)</mark>

{% code overflow="wrap" %}

```html
<script>
	window.Offer18SDK.init({
		automatedTrigger: true,
		opeations: [{
			triggerFunction: "trackImpression",
			triggerconditios: [
				{
					mode: "<condition-mode>", // contain or equal
					type: "<condition-type>", // path / hostname / referral
					value: "<condition-value>"
				}
			],
			triggerConfig: {
				impressionURL: "https://example.com?i/o=xxx&m=000&a=000",
				keymapping: ['<OFFER18-PARAMETER>:<YOUR-PARAMETER>', '<OFFER18-PARAMETER>:<YOUR-PARAMETER>', ...]
			}
		}]
	})
</script>
```

{% endcode %}

***

### Отслеживание конверсий

Пользователям необходимо добавить следующий фрагмент кода на все посадочные страницы, за исключением страницы подтверждения заказа / страницы успеха заказа (страницы "Спасибо").

<mark style="color:пурпурный;">Размещение : Заголовок (Все страницы)</mark>

```html
<script>
	window.Offer18WebSDK.init({
		automatedTrigger: true,
		operations: [
			{
				triggerFunction: "initializeUrlParam",
				triggerConditions: [
					{
						mode: "<condition-mode>", // contain or equal
						type: "<condition-type>", // path / hostname / referral
						value: "<condition-value>"
					}
				],
				triggerConfig: {
					clickIdParameter: "<YOUR-CLICK-ID-PARAMETER>",
				}
			}
		]
	})
</script>
```

После этого добавьте следующий код на страницу благодарности/подтверждения заказа на вашем сайте.

<mark style="color:пурпурный;">Размещение : Страница благодарности/Страница успешного заказа (Одна страница)</mark>

```html
<script>
	window.Offer18WebSDK.init({
		automatedTrigger: true,
		operations: [
			{
				triggerFunction: "trackConversion",
				triggerConditions: [
					{
						mode: "<condition-mode>", // contain or equal
						type: "<condition-type>", // path / hostname / referral
						value: "<condition-value>"
					}
				],
				triggerConfig: {
					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>
```

### Режим отладки <a href="#debug-mode" id="debug-mode"></a>

Чтобы включить режим отладки в SDK, можно добавить следующий код внутри вашего скрипта:

```html
<script>
    window.Offer18WebSDK.activateDebugMode();
</script>
```

Включение режима отладки позволяет получить более подробную информацию о работе SDK, включая любые ошибки или отладочные сообщения.

### Пример кода

```html
<script src="https://web-resources.offer18.net/sdk/web/WebSDK.js"></script>
<script>
    window.Offer18SDK.init({
        automatedTrigger: true,
        opeations: [{
            triggerFunction: "trackClick",
            triggerconditios: [
                { mode: "equal", type: "hostname", value: "websiteurl.com" }
            ],
            triggerConfig: {
                trackingURL: "https://example.o18.click/c?o=0000000&m=0000",
                keymapping: ['a:utm_source']
            }
        },
        {
            triggerFunction: "trackImpression",
            triggerconditios: [
                { mode: "equal", type: "hostname", value: "websiteurl.com" }
            ],
            triggerConfig: {
                impressionURL: "https://example.o18.click/i?o=0000000&m=0000",
                keymapping: ['a:utm_source']
            }
        },
        {
            triggerFunction: "initializeUrlParam",
            triggerconditios: [
                { mode: "equal", type: "hostname", value: "websiteurl.com" }
            ],
            triggerConfig: {
                clickIdParameter: "tid",
            }
        },
        {
            triggerFunction: "trackConversion",
            triggerConditions: [
                { mode: "equal", type: "hostname", value: "websiteurl.com" },
                { mode: "contain", type: "path", value: "thank-you" }
            ],
            triggerConfig: {
                domain: 'example.o18.link',
                accountId: '0000',
                offerId: '00000000',
            }
        }
        ]
    });
</script>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://knowledgebase.offer18.com/ru/set/sdk/avtomaticheskii-trigger.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
