### XTracky Tracking Script Installation Source: https://docs.xtracky.com/index Instructions on how to install the XTracky tracking script on your website pages. ```APIDOC ## XTracky Tracking Script Installation ### Description Insert the following script into ALL pages of your funnel immediately after the `
` tag to enable visitor tracking. ### Script ```html ``` ### Configuration * **data-token**: Replace `YOUR_PRODUCT_TOKEN` with your actual product ID from XTracky. * **data-click-id-param**: Parameter to capture the `click_id`. It is generally recommended to keep this as `click_id`. ``` -------------------------------- ### Install XTracky Tracking Script Source: https://docs.xtracky.com/index Insert this script into all pages of your funnel immediately after the tag. It handles UTM parameter tracking. Ensure the data-token is replaced with your product ID. ```html ``` -------------------------------- ### Send Conversion Event Source: https://docs.xtracky.com/index Documentation for sending conversion data to the XTracky API via a POST request. ```APIDOC ## Send Conversion Event ### Description Send a POST request to this endpoint whenever a sale is completed to record the conversion event. ### Method POST ### Endpoint `https://api.xtracky.com/api/integrations/api` ### Parameters #### Request Body - **orderId** (string) - Required - Unique identifier for the sale. - **amount** (integer) - Required - The sale amount in cents (e.g., R$ 1.00 = 100). - **status** (string) - Required - The current payment status. Accepted values: `waiting_payment`, `paid`. - **utm_source** (string) - Required - The value of the `utm_source` parameter from the visitor's URL. ### Request Example (JSON) ```json { "orderId": "AB123", "amount": 100, "status": "waiting_payment", "utm_source": "facebook_ads" } ``` ### Response #### Success Response (200) This endpoint typically returns a 200 OK status upon successful processing. Specific response body details may vary. #### Error Handling * **Duplicate Requests**: Duplicate requests will not be processed to prevent event duplication. ### Notes * **UTM Source**: Ensure you capture and send the `utm_source` value from the visitor's URL for accurate traffic source tracking. * **Kwai Integration**: Each request sent to this endpoint automatically generates a new event in Kwai for complete conversion tracking on the platform. ### Examples #### JavaScript (Fetch API) ```javascript // Capture utm_source from URL const urlParams = new URLSearchParams(window.location.search); const utmSource = urlParams.get('utm_source') || ''; // Send conversion fetch('https://api.xtracky.com/api/integrations/api', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ orderId: 'AB123', amount: 100, status: 'waiting_payment', utm_source: utmSource }) }); ``` #### cURL ```bash curl -X POST https://api.xtracky.com/api/integrations/api \ -H "Content-Type: application/json" \ -d '{ "orderId": "AB123", "amount": 100, "status": "waiting_payment", "utm_source": "facebook_ads" }' ``` #### PHP ```php 'AB123', 'amount' => 100, 'status' => 'waiting_payment', 'utm_source' => $utmSource ); // Configure the request $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents('https://api.xtracky.com/api/integrations/api', false, $context); if ($result === FALSE) { /* Handle error */ } ?> ``` ``` -------------------------------- ### Send Conversion Data to XTracky API Source: https://docs.xtracky.com/index Send conversion data via a POST request to the XTracky API endpoint. The request body should be in JSON format and include order details and UTM parameters. The script automatically generates an event in Kwai for each request and prevents duplicate submissions. ```json { "orderId": "AB123", "amount": 100, "status": "waiting_payment", "utm_source": "..." } ``` ```javascript // Capturar utm_source da URL const urlParams = new URLSearchParams(window.location.search); const utmSource = urlParams.get('utm_source') || ''; // Enviar conversão fetch('https://api.xtracky.com/api/integrations/api', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ orderId: 'AB123', amount: 100, status: 'waiting_payment', utm_source: utmSource }) }) ``` ```curl curl -X POST https://api.xtracky.com/api/integrations/api \ -H "Content-Type: application/json" \ -d '{ "orderId": "AB123", "amount": 100, "status": "waiting_payment", "utm_source": "facebook_ads" }' ``` ```php 'AB123', 'amount' => 100, 'status' => 'waiting_payment', 'utm_source' => $utmSource ); // Configurar a requisição $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents('https://api.xtracky.com/api/integrations/api', false, $context); if ($result === FALSE) { /* Handle error */ } else { /* Process result */ } ?> ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.