How to integrate a platform without a pre-built AnyTrack Integration

Learn how to integrate any eCommerce platform with AnyTrack standard tracking parameters.

If you’re using an eCommerce platform not currently supported by one of AnyTrack's pre-built integrations or you’ve built your own cart solution, you can integrate it with AnyTrack using our JavaScript Tag and server-side API.

In this guide, you will learn how to integrate any third-party platform with AnyTrack and leverage every possible tracking and attribution feature available for integrated partners.

Warning Notice

These guidelines are provided "as is", and such implementation can only be performed by a skilled developer with access to the platform's codebase or API.

If you don't have access to development resources, or if your developer is not up to the task, don't hesitate to get in touch with us, and we will refer you to a vetted developer.

Before you begin, you will need the following:

  • An AnyTrack account with a Personal or Advanced plan
  • Access to your platform back-end and API
  • Access to your website code

Key Integration Components

The key components of integrating this type of eCommerce solutions are:

  • The click_id parameter
    The click_id value that AnyTrack auto-generates for every event triggered via the JS tag enables AnyTrack to attribute the events to your website's visitors, identify them and tie first-party data collected through the customer journey with marketing channels, campaigns, and other traffic-related parameters.
  • Customer data
    Tracking information such as name, email, phone number, or other customer attributes
  • Website engagements & customer journey
    Tracking customer journey activity, what products they view, etc.
  • Purchase activity
    Tracking purchases and purchase attributes (product names, SKU, currencies, etc...)

Keep in mind that as long as events are sent to AnyTrack (via JS or server-side API), they will be automatically formatted and standardized according to the ad pixels, APIs, and analytics requirements.

About JavaScript and Server-Side Tracking (Webhook)

This guide focuses on how to track important customer activities in AnyTrack. While certain events can be sent interchangeably via JS tag or server-side API, we highly recommend you follow the below guidelines to guarantee the highest attribution and data collection quality.

Use our JavaScript Tag for the following activities:

  • Viewed Product
    When someone views a product
  • Form Submissions
    When visitors subscribe to your newsletters or a special offer
  • Add to Cart
    When someone adds a product to their cart
  • Initiate Checkout
    When someone starts the checkout process
  • User Identification
    Send a unique identifier to a third-party marketing system for first-touch attribution.

Use the server-side tracking for the following:

Server-side events are sent through webhooks (also called postback URLs or server-to-server URLs). They require that the click_id value generated during the website events is sent back to AnyTrack in the JSON (or query parameters payload).

You should read this guide if you're unfamiliar with server-side tracking requirements.

How it works:

  1. When a visitor adds a product to the cart, the AnyTrack Tag triggers an event and sends a unique click_id to the cart
  2. When the purchase is triggered, your platform calls the Anytrack webhook URL and passes the purchase data, INCLUDING THE CLICK_ID PARAMETER FROM THE CART.
  3. AnyTrack ingests the data and sends the conversion data back to the ad platforms.

What are the events you should send via Server Side Tracking

  • Purchase
    Events coming from your back-end server
  • Customer creation
    When a customer is created in your platform
  • Lead creation
    When a user confirms their newsletter subscription

The attributes you send to AnyTrack alongside each type of event will enable you to improve your marketing channel attribution, the data quality used to enrich your audience data, and overall improve your data-driven marketing.

Note that the snippets in this guide use example data. Therefore, you will need to update the values of the JSON properties that dynamically feed the snippet with the relevant values.

JavaScript Tag for website engagements

Use the Javascript Tags to programmatically trigger events on your website and send granular data to AnyTrack.

Note that any of the snippets provided below can only work as long as the main AnyTrack Tag is in the head section of your site.

View Product Event

When a visitor is viewing a specific product.

<script>
var click_id = AnyTrack('trigger', 'ViewContent', {
items: {
id: '20291', // the item catalog id (required)
name: 'Sony MDRZX110/BLK ZX Series Stereo Headphones',
price: 19.9, // the item price (required)
currency: 'USD', // if omitted will default to your property currency
brand: 'Sony'
}
});
</script>

Add To Cart Event

<script>
var click_id = AnyTrack('trigger', 'AddToCart', {
items: {
id: '20291', // the item catalog id (required)
name: 'Sony MDRZX110/BLK ZX Series Stereo Headphones',
quantity: 1,
price: 19.9, // the item price (required)
currency: 'USD', // if omitted will default to your property currency
brand: 'Sony'
}
});
</script>

Initiate Checkout Event

<script>
var click_id = AnyTrack('trigger', 'InitiateCheckout', {
items: [{
id: '20291', // the item catalog id (required)
name: 'Sony MDRZX110/BLK ZX Series Stereo Headphones',
quantity: 1,
price: 19.9, // the item price (required)
brand: 'Sony'
}, {
id: '49292',
name: '6.35mm Beats Male 3.5mm Female Headphone Stereo Audio Connector',
quantity: 1,
price: 4.1,
brand: 'Beats'
}]
});
</script>

User identification

Use this snippet to identify new customers on your website. Usually, you want to do this when the visitor submits a form or registers to your website.

var atclid = AnyTrack('atclid');

The form submission event - AutoTrack

When a visitor submits a form for a newsletter or a special offer.

Note that AnyTrack will AutoTrack form submissions, and as you add the parameter alongside the form submission: --CLICK-ID--

Pass a click_id in the form Action URL

<form action="/action_page.php?atclid=--CLICK-ID--">
<label for="firstName">First name:</label><br>
<input type="text" id="firstName" name="fname" value="John"><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname" value="Doe"><br><br>
  <input type="submit" value="Submit">
</form>

Pass the click_id in a hidden field

<form action="/action_page.php">
<label for="firstName">First name:</label><br>
<input type="text" id="firstName" name="fname" value="John"><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="hidden" name="atclid" value="--CLICK-ID--">
<input type="submit" value="Submit">
</form>

Note that we highly recommend creating a custom field in your third-party system so that you can further use the click_id value to send events to AnyTrack.

Form Submission Custom Events

Unlike the previous methods, which AutoTrack the forms if the click_id parameter is found in the form fields or action attribute, this method lets you trigger the forms programmatically and based on the conditions you set.

This method is specifically useful when you use dynamic forms generated by JavaScript (Hubspot, Typeform, Landbot, and others)

<script>
var click_id = AnyTrack('trigger', 'FormSubmit', {
firstName: 'Elon',
lastName: 'Musk',
email: 'elon@twitter.com',
formName: '50% offer for new business owners',
formId: 'XJW0047',
click_id: 'click_id'
});
</script>

You can pass the parameter FullName: Elon Musk, and we will automatically format it according to your analytics and ad pixels requirements.

Alias the AnyTrack click_id to an external id

In some cases, the platforms you are integrating with cannot accept custom parameters such as the AnyTrack click_id. For example, the Kajabi platform doesn't let you create a hidden field to pass custom data into a form submission.

For such cases, you can alias the AnyTrack click_id that is generated during the triggered event with a value that the platform generates at run time, such as a lead id, email address, or phone number.

Reminder:

Server-side tracking is only possible when AnyTrack has collected or passed an identifier that the platform can returned via their webhook or API end-point.

Example with AnyTrack Click ID:

During the AddToCart event AnyTrack passes click_id to the cart object, and during the purchase event, the platform returns the same click_id in the webhook payload.

Example with an External ID:

During the AddToCart event AnyTrack Alias the event click_id with the cartId, and during the Purchase event, the platform returns the cartId in the webhook payload.

Alias the click_id to the customer email address:

When the event is triggered, the payload will record the refId=elon@twitter.com as the click_id.

As a result, when AnyTrack receives a server-side conversion with:

refId=elon@twitter.com

It will associate the refid with the clickid reference previously stored.

Step 1: How aliasing click_id and an external id works:

  1. AnyTrack records the event FormSubmit
  2. AnyTrack stores a real click_id value: f8e3bf8dfba8b51ce3340
  3. AnyTrack registers the refId=elon@twitter.com as the click_id=f8e3bf8dfba8b51ce3340
<script>
AnyTrack("trigger", "FormSubmit", {
refId: 'elon@twitter.com',
email: 'elon@twitter.com',
fullName: 'Elon Musk'
});
</script>

Step 2: Send the External ID in Webhooks

Since the lead email address exists in your third-party system, you can send it as part of the webhook URL using one of the following structures and parameters.

Note regarding personal data:

We recommend ONLY sending customer data through server-side tracking and API. Passing personal data to your 'thank you' page, such as:

/thank-you?email=elon@twitter.com

It is not safe for your business or your subscribers.

Webhook / Postback URL with query string parameters

https://t1.anytrack.io/GqxV3nTo/collect/custom-test?refId=elon@twitter.com&event_name=Lead

Webhook URL+JSON:

https://t1.anytrack.io/GqxV3nTo/collect/custom-test

JSON Payload

{
"refId": "elon@twitter.com",
"email": "elon@twitter.com",
"fullName": "Elon Musk",
"userId": "8d7uyy756h",
"timestamp": 1631196490,
"eventname": "registration",
"eventid": "asduf0oasd8f0asd8f0asd9f8",
"funnelname": "New Business Owners Checklist",
"funnelid": "232323"
}

In most cases, since your system will not be able to add a refid parameter to the webhook payload, you will have to use a connector such as Zapier to remap the event properties.

Events sent via Server-side API, Webhooks, or Postback URLs

In all cases, the Webhook base URL is always the same and is called via your server or an application at run time (when the event is triggered.) You can send custom or standard events as long as you send the required parameters. A full list of standard parameters can be found here.

Lead Event

When Elon Musk confirms his newsletter subscription.

If you use Klaviyo to send your newsletters, you will want to guarantee the best possible email delivery by double-optin your subscribers. You will also want to measure the conversion ratio between single and double opt-ins.

If you are a fanatic about your data, this type of segmentation will save you tons of money and increase your BOF conversion rates.

{
"click_id": "f8e3bf8dfba8b51ce3340",
"email": "elon@twitter.com",
"fullName": "Elon Musk",
"userId": "8d7uyy756h", //userid in your own system
"event_name": "Lead", // Standard Event name supported by AnyTrack
"eventid": "asduf0oasd8f0asd8f0asd9f8", //id generated by your system
"funnelname": "New Business Owners Checklist",
"funnel_id": "232323"
}

Customer Creation Event

When a subscriber completes its first purchase or completes a full registration on your website - for example, address, DOB, full name, company name, etc... 

{
"click_id": "f8e3bf8dfba8b51ce3340",
"email": "elon@twitter.com",
"fullName": "Elon Musk",
"address": "Milky Way 1",
"country": "Space",
"state": "Galaxy1",
"company": "Space X",
"website": "https://spacex.com",
"userId": "8d7uyy756h", //userid in your own system
"timestamp": 1631196490,
"event_name": "CompleteRegistration", // Standard Event name supported by AnyTrack
"eventid": "asduf0oasd8f0asd8f0asd9f8", //id generated by your system
"brand_name": "New Business Owners Checklist",
"funnel_id": "232323"
}

Purchase Event

This is the most important event as it includes the entire data payload you'll want to send to your analytics and ad pixels. Because it includes a lot of data points that can be used by the ad pixels to attribute and optimize your ad delivery, we highly recommend sending as much data as possible.

Key value pairs, in bold, are used in the tracking, conversion, and attribution logic - including deduplication, user identification, and conversion fallback.

https://t1.anytrack.io/GqxV3nTo/collect/custom-test
{
    "eventname": "Purchase",
  "click_id": "f8e3bf8dfba8b51ce3340",
    "email": "elon@twitter.com",  
"refId": "elon@twitter.com",
    "fullName": "Elon Musk",
    "address": "Milky Way 1",
    "phone": "+1919875666",
    "country": "Space",
    "items": [{
        "id": "20291",
        "name": "Sony MDRZX110/BLK ZX Series Stereo Headphones",
        "quantity": 1,
        "price": 20.00,
        "brand": "Sony"
  },
{
        "id": "49292",
        "name": "Beats Headphones",
        "quantity": 1,
        "price": 100.00,
        "brand": "beats"
    }],
    "currency": "USD",
    "id": 24356562534585,
    "subtotalprice": 120.00,
    "totalprice": 120.00,
    "taxPrice": 10,
"commission": 120.00,
    "transactionId": "#24356562534585"
}

Note that the same JSON payload can be converted into query string

eventname=Purchase&clickid=f8e3bf8dfba8b51ce3340&email=elon@twitter.com&refId=elon@twitter.com&fullName=Elon Musk&address=Milky Way 1&phone=+1919875666&country=Space&items[0][id]=20291&items[0][name]=Sony MDRZX110/BLK ZX Series Stereo Headphones&items[0][quantity]=1&items[0][price]=20&items[0][brand]=Sony&items[1][id]=49292&items[1][name]=Beats Headphones&items[1][quantity]=1&items[1][price]=100&items[1][brand]=beats&currency=USD&id=24356562534585&subtotalprice=120&totalprice=120&taxPrice=10&commission=120&transactionId=#24356562534585

Customer parameters (matching parameters)

The parameters below can be ingested by AnyTrack and automatically forwarded to your analytics and ad pixels via server-side API.

Note that before sending these parameters to your integrations, AnyTrack processes the data according to each of the integration requirements.

🚫 Google Analytics:

AnyTrack doesn't send these parameters to Google Analytics since it's against their terms of use. 

✅ Meta Conversion API:

AnyTrack hashes the personal data before sending it to Meta CAPI.

 

Parameter name Type Example Notes
email string jsmith@example.com  
firstName string John  
lastName string Smith  
fullName string John Smith Optional, can be provided instead of first and last names
phone string +1 (650) 555 4444 Including country code and area code
birthdate string May 26, 1991 or 1991-05-26  
city string Menlo Park  
state string CA Two-letter state or province code
zipcode number 94025 Zip or Postal Code
country string US or United States

Two-letter country code is recommended

Event Parameters:

AnyTrack supports the following parameters and automatically maps them to standard event parameters used by ad pixels and analytics platforms to attribute conversions and build custom audiences.

We regularly update this list, so if you'd like to see additional parameters, please send a request to the support.

Parameter name Type Default Value Notes
id string - The link id
url string - The event link
label string - The link label
brand_name string - Brand name
commission number - Revenue
currency string Property Currency 3 letters currency (ie. "USD" or "EUR")
transactionId string - Required: The transaction or order id generated by your payment system or shop.
shippingPrice number -  
taxPrice number -  
items EventItem[] [] Array of items, see below
refId string - If you used a refId parameter to alias the anytrack click_id 

Item parameters:

Item parameter Type Default Value Notes
id string - The item id/sku (required)
name string - The item name
quantity number 1 amount of items
price number - the item price (required)

Validate your integration

AnyTrack provides you with the tools that enable to verify the accuracy of your integration in real-time.

Integration Event Log

When adding the custom integration, you'll have access to the Event Log where you will see a real time stream of conversion events and their complete payload.

Each event triggers a status and error messages.

Conversion Events Report

The conversion event screen gives you the full customer journey where you will be able to inspect each event - whether triggered from the JS tag or from the Server side integration.