Skip to content

Conversion tracking

The data provided in conversion tracking is used to provide better personalization as well as providing data for sales performance analyitcs accessible on my.helloretail.com.

Conversions should be tracked immediately when they occur on the webshop. This is typically implemented using the javascript SDK but can also be implemented using the REST API. The tracked cart is associated with the visitors trackingUserId.

We have information about how to configure conversion tracking for various platforms in on our support pages.

Beyond conversion tracking it is also often a usefull to provide Hello Retail with an order feed. This makes it possible to import historic orders and import orders from other sales channels.

Conversion tracking using the SDK

When a conversion occurs you can track it by calling the trackConversion method. The method accepts two arguments:

Arguments

Argument Type Description
data Conversion object See specification of the conversion object below.
callback() function Will be called without any arguments when conversion tracking is finished. Optional.

Properties of the Conversion object

Property Type Description
total Number The total value of the conversion.
orderNumber String Unique order number for this conversion. Must be identical to the order number provided in any order feeds
email String Email addres of the customer making the order
customerId String If you have an internal ID for the customer you can optionally include it here. You might have this if the customer is logged in
products Product[] A list of products in the order. See the description of the Product object below

More information about the Product object

Property Type Description
productNumber String The ID of the product
url String The URL to the product.
quantity Number The number of the specific products sold in the order
lineTotal Number The price for the specific products

Example

hrq = window.hrq || [];
hrq.push([
    "trackConversion",
    {
        total: 111.28,
        orderNumber: '110-2350',
        email: 'customer@example.com',
        customerId: '53967',
        products: [
            { 
                productNumber: '38', 
                url:'https://myshop.com/product/vneck-tee/1'
                quantity:3, 
                lineTotal:99.14

            },
            { 
                productNumber: '132', 
                url:'https://myshop.com/product/shirts/1'
                quantity:1, 
                lineTotal:12.14

            },
        ]
    }, 
    function() {
        console.log('Conversion has been tracked');
    }
]);

Conversion tracking using the REST API

The Hello Retail SDK uses a REST API endpoint to track the conversion. This API can also be used directly.

Request

The endpoint is available at https://core.helloretail.com/serve/collect/conversion. You use it by sending a HTTP POST request with a JSON body. The content type must be application/json or text/plain 1.

The JSON body must match the Conversion Object documented for the javascript SDK above, but it must also contain the trackingUserId of the visitor and whe websiteUuid of the webshop.

Example of the structure the JSON body must have:

curl --request POST \
--url https://core.helloretail.com/serve/collect/conversion \
--header 'content-type: application/json' \
--data '{
    "total": 111.28,
    "orderNumber": "110-2352",
    "email": "customer@example.com",
    "customerId": "53967",
    "products": [
        {
        "productNumber": "38",
        "url": "https://myshop.com/product/vneck-tee/1",
        "quantity": 3,
        "lineTotal": 99.14
        },
        {
        "productNumber": "132",
        "url": "https://myshop.com/product/shirts/1",
        "quantity": 1,
        "lineTotal": 12.14
        }
    ],
"websiteUuid": "4cc49be5-68dd-479f-9f34-d562511a66d3",
"trackingUserId": "674edd8d24917055f53a3dbd"
}'

Most of the JSON body is similar to the call above in the JavaScript SDK example, the only difference is trackingUserId and websiteUuid.

Property Type Description
trackingUserId String Tracking user id that has been generated by Hello Retail. You can read more about the tracking user here
websiteUuid String The id identifying the website in Hello Retail. This can be found on my.helloretail.com

Response

The response will indicate if the tracking succeeded. A success response will have the 200 response code. The body of the response will look like this:

{
    "success": true,
    "message": "Conversion tracked"
}

If the tracking fails because of invalid input the response will have the 400 response code. An example could be not supplying the websiteUuid or supplying a websiteUuid that does not match a website. This will result in the following response:

{
    "success": false,
    "message": "Website not found"
}

If the tracking fails for other reasons it will fail with the 500 response code. If you experience this please contact Hello Retail support.


  1. The reason for supporting text/plain is to allow requests to this endpoint, made from the browser, to be categorized as simple thereby avoiding CORS preflight requests. You can read more here https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests