Website Integration

In order for conversion captures to work automatically your website needs to be integrated with Adestra, to ensure any basket data and purchases can be recorded. This will allow Adestra to identify when a capture campaign can be sent and what it should contain.

Note: The capture must have a campaign associated with it work, otherwise the tracking pixel will fail to load

On this page:

Data Transport Mechanism

There are various potential mechanisms to get data from the site to Adestra, the only currently implemented system is to encode the data into the query string of a URL to our basket capture endpoint, and embed it into the site using an <img> tag.

There are two basic functions, one to update the basket with new information and one to mark the basket as purchased. The update call can be made as frequently as necessary (typical implementations are expected to call it on every page when there's basket data present, although it will be sufficient to call it every time the basket contents changes). The purchase call should be made once the visitor has finished a process, for example on a purchase confirmation page.

Image Tag Format

The endpoint is: <client domain>/q/basket

Query String Parameters

action Indicates the type of request. Can be set to "update" or "purchase".
account_id ID of your account.
capture_id ID of the capture record to which this basket relates.
token Token to use to identify this visitor. Typically you'd set this to your site's session ID. It's important this is unique for each visitor.
email Email address of the visitor (if you have it).
order_value Total value of the order, without currency prefix.
record Optional. JSON-encoded data structure representing contact information (such as name, address, etc).
item JSON-encoded data structure describing an item in the visitor's basket. This can be included multiple times, once for each item in the basket. See below for details.

Item Data Structure

The following fields are supported by the item entry:

ref Reference used to identify the product. Should be unique for each product (eg, product code, sku, etc).
name Name used to describe the product
value Current value of the item in the basket
quantity Integer representing the number of these items
image_url URL to a suitable product image

Note: Both ref and name have 100 character limits.

Update Call

The update call (with the action parameter set to update) should be made on every page where the basket contents changes. It's recommended to place this call on every page when the visitor has any items in their basket.

The update call should contain the following parameters:

  • action (set to 'update')
  • account_id
  • capture_id
  • token
  • order_value
  • email (optional)
  • item (once per basket item)
  • record (optional)

Example URL (with formatting and without encoding for clarity)

Copy
http://<client domain>/q/basket
    ?action=update
    &account_id=9999
    &capture_id=1
    &token=55db194b61d1b0bc96d488ecf7efd9ae
    &email=barry@adestra.com
    &record={ 
        "forename":"Barry", 
        "surname":"Grinner", 
        "address_line":"42 Wallaby Way", 
        "2.misc_info":"Electrician"    }
    &order_value=27.34
    &item={
        "ref":"sku0001",
        "name":"Manifold Sprocket",
        "value":1.34,
        "quantity":1,
        "image_url":"http://foo.com/sku0001.jpg"    }
    &item={
        "ref":"sku0078",
        "name":"Recombobulator Valve",
        "value":7.28,
        "quantity":3,
        "image_url":"http://foo.com/sku0078.jpg"    }

Example of final, encoded tag (the final version would be on a single line):

Copy
<img src="http://<client_domain>/q/basket?action=update&account_id=630&capture_id=1&token=55db194b61d1b0bc96d488ecf7efd9ae&email=barry@adestra
.com&order_value=27.34&item={%22ref%22:%22sku0001%22,%22name%22:%22Mani
fold%20Sprocket%22,%22value%22:1.34,%22quantity%22:1,%22image_url%22:%2
2http://foo.com/sku0001.jpg%22}&item={%22ref%22:%22sku0078%22,%22name%2
2:%22Recombobulator%20Valve%22,%22value%22:7.28,%22quantity%22:3,%22ima
ge_url%22:%22http://foo.com/sku0078.jpg%22}">

Purchase Call

The purchase call (with the action parameter set to purchase) should be made once after the visitor has completed the checkout process (for example on a purchase confirmation page).

The purchase call should contain the following parameters:

  • action (set to 'purchase')
  • account_id
  • capture_id
  • token

Other parameters will be ignored.

Example URL (with formatting and without encoding for clarity)

Copy
http://<client domain>/q/basket
    ?action=purchase
    &account_id=9999
    &capture_id=1
    &token=55db194b61d1b0bc96d488ecf7efd9ae

Example of final, encoded tag (the final version would all be on a single line):

Copy
<img src="http://<client_domain>/q/basket?action=purchase&account_id=99
99&capture_id=1&token=55db194b61d1b0bc96d488ecf7efd9ae">