Integrating Avelon with your custom website

If you are not using an eCommerce CMS that we have a native integration for, you will be required to integrate through our API. In this article, we’ll outline exactly how to integrate Avelon with your custom website.

Link to all documentation

There is a link to all our custom integration documentation below. Please follow this documentation to perform the integration. 

What does the attribution workflow look like?

For reference, this is how we attribute a sale to an affiliate:
  1. User clicks Avelon affiliate link at which point our API generates a click ID and device ID
  2. Redirect to your site with click ID in the URL (avln_cid parameter)
  3. Our script picks it up and sets it in a cookie
  4. User checks out
  5. Call to Avelon API purchase endpoint (set bearer token in security header for auth). This is where you must pass the click ID and/or any promo codes used to our API

We do not require you to submit and purchases that do not have a click ID or at least one promo code as they will not be attributable. You can exclude optional fields from the JSON. The payload must contain either avln_cid or promo_codes or both. Without at least one of these, there is no way for us to attribute a sale.

For websites with a conversion point (sale/checkout process)

Avelon drops cookies and tracks purchases through a two-step function: by dropping a cookie on the user when they come through an affiliate link and by you, the Merchant, passing across all the order information if there is a valid click ID or promo code.

Dropping a cookie: for Avelon to place a cookie on the user, you must add the script in the integration docs to each page on your site. 

Recording a purchase: you must send each purchase to us that has a valid click ID or at least one promo code. When you send these purchases to us, we then attribute the sale to the specific affiliate the click ID or promo code corresponds to. 

An example of the payload we require for all purchases is below:

				
					{
  "avln_cid": "710b0b92-1a09-4623-b46a-bca2506e893d",
  "transaction_id": "string",
  "currency": "GBP",
  "promo_codes": [
    "AVLN0001",
    "AVLN0002"
  ],
  "items": [
    {
      "item_price": 10.35,
      "item_commission": 0.15,
      "item_id": "abc123",
      "item_name": "27.5 INCH MOUNTAIN BIKE ROCKRIDER ST 100 - YELLOW",
      "item_category": "bikes",
      "item_quantity": 2,
      "item_metadata": "{\"foo\": \"bar\"}"
    }
  ]
}
				
			

Responses

201: Purchase recorded
400: Payload invalid
401: Bearer token expired or invalid

Breakdown of requirements

avln_cid (required): Avelon clickID, this comes from the avln_cid cookie our script drops when we redirect to your site via an affiliate link click. Used to attribute sales.

transaction_id (required): your transaction ID. We report these back to you and we also use it to deduplicate purchases if one is submitted more than once.

currency (required): checkout currency

promo_codes (required if there were any promo codes used): Any promo code used for the purchase. We use these to attribute sales.

items (required): line items

item_price (required): the final unit price (single item) that was paid after any discount

item_commission (optional): you can pass in explicit commission for each sale if you want to, but you probably won’t need to use this

item_id (required): the line item’s product ID. We use this for reporting in the dashboard (e.g. aggregating sales by item) as well as product level commission

item_name (required): the line item’s name. Used for reporting

item_category (optional): the line item’s category. Used for category level commission

item_quantity (required): how many of the product were purchased

item_metadata (optional): any additional data you want to pass in, can be used for reporting

Contact Support

If you require any support on the above, please contact the Support Team or email your Account Manager.

Discover more from Avelon

Subscribe now to keep reading and get access to the full archive.

Continue reading