Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Add backend webhooks

Learn how to setup custom webhooks

Before you start

This article picks up where Custom User Data and custom datalayer leaves off. Make sure all of the steps in the Setup AdPage container article have been followed. Which means that:

Install webhooks

Backend webhooks provide more accurate measurement. In eCommerce, send a webhook when an order is created. This is the primary conversion.

Webhooks require additional website configuration. Test the implementation thoroughly.

Send webhooks to configures server container URL for example: https://tagging.domain-name.com/order_created

The webhook payload

Use the following payload for an eCommerce website. Send it in JSON format. Do not deviate from this example. Changes can negatively affect tracking.

{

  "event": "trytagging_purchase",

  "ecommerce": {

    "transaction_id": "43",

    "affiliation": "",

    "value": 45.0,

    "tax": 0.0,

    "shipping": 0.0,

    "currency": "EUR",

    "coupon": "",

    "items": [

      {

        "item_name": "copy hoodiiiee",

        "item_id": "23",

        "price": 45.0,

        "quantity": 1,

        "index": 1

      }

    ]

  },

  "user_data": {

    "customer_id": 1,

    "customer_email": "jeroen@adpage.io",

    "customer_name": "Jeroen Test",

    "customer_phone": "0612345678",

    "customer_address": "Velmolenweg 54a",

    "customer_zip": "5404 LD",

    "customer_country": "NL",

    "customer_city": "Uden",

    "customer_state": "Province",

    "customer_country": "Netherlands",

    "billing_first_name": "Jeroen",

    "billing_last_name": "Test",

    "billing_address": "Velmolenweg 54a",

    "billing_postcode": "5404 LD",

    "billing_state": "",

    "billing_city": "Uden",

    "billing_email": "jeroen@adpage.io",

    "billing_phone": "0612345678",

    "shipping_first_name": "Jeroen",

    "shipping_last_name": "Test",

    "shipping_company": "",

    "shipping_address": "Velmolenweg 54a",

    "shipping_postcode": "5404 LD",

    "shipping_country": "NL",

    "shipping_state": "",

    "shipping_city": "Uden",

    "shipping_phone": "",

    "new_customer": "true"

  },

  "marketing": {

    // Front-end marketing data and the following field:

    "ip": "visitor_ip_address"

  }

}

The marketing object

The marketing object comes from the front-end tracking script. Send this data object in the backend webhook payload. See add custom user data script to site.

The following function is only an example. Do not copy it directly.

Last updated

Was this helpful?