
If you’re using an eCommerce platform not currently supported by one of AnyTrack 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 features available for integrated partners.
The guidelines are provided "as is" and its implementation can only be performed by a skilled developer who has access to the platform's code base or API. If you don't have access to development resources, or if your developer is not up to the task, please contact us and we will refer you to a vetted developer.
Before you begin you will need:
- An AnyTrack account with a Personal or Advanced plan
- Access to your platform backend 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 value that is autogenerated by AnyTrack for every single event triggered via the JS tag and that 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
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 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 to a special offer - Added to Cart
When someone adds a product their cart - Initiate Checkout
When someone starts the checkout process - User Identification
Send a unique identifier to third party marketing system for first touch attribution
Use our webhook for the following:
Server-side events are sent through webhooks (also called postback URLs or server to server URLs) and require that the click_id value generated during the website events is sent back to AnyTrack in the json (or query parameters payload).
- Purchase
Events coming from your back end server - Customer creation
When a customer is created in your platform - Lead creation
When a user confirms its newsletter subscription
The attributes you send to AnyTrack alongside each type of events 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.
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');
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 the form attributes as long 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?click_id=--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 as form 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="click_id" 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 JavaScripts (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 Reference ID (refId)
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.
For such cases, you have the ability to alias the AnyTrack click_id that is generated during the triggered event, with value that the platform accepts such as a lead id, email address or phone number.
Alias the click_id to the customer email address:
When the event is triggered, the payload will register the refId=elon@twitter.com as the click_id.
Step #1: How aliasing click_id and an external id works:
- AnyTrack records the event FormSubmit
- AnyTrack stores a real click_id value: f8e3bf8dfba8b51ce3340
- 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 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.
Postback URL with query string parameters
https://t1.anytrack.io/GqxV3nTo/collect/custom-test?refId=elon@twitter.com&event_name=Lead
Webhook JSON payload:
Base Webook URL
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,
"event_name": "registration",
"event_id": "asduf0oasd8f0asd8f0asd9f8",
"funnel_name": "New Business Owners Checklist",
"funnel_id": "232323"
}
In most cases. since your system will not be able to add a ref_id parameter to the webhook payload you will have to use a connector such as Zapier to first receive the event. You'll then be able to add the ref_id / value to the payload sent to AnyTrack. If you're not familiar with Zapier please contact us and we'll send you a Zapier template.
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 events or standard events, as long as you send the required parameters. 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 optins.
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
"event_id": "asduf0oasd8f0asd8f0asd9f8", //id generated by your system
"funnel_name": "New Business Owners Checklist",
"funnel_id": "232323"
}
Customer Creation Event
When a subscribers 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",
"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
"event_id": "asduf0oasd8f0asd8f0asd9f8", //id generated by your system
"funnel_name": "New Business Owners Checklist",
"funnel_id": "232323"
}
Purchase Event
This is the most important event as it includes the entire data payload that 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 to send 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
{
"event_name": "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,
"subtotal_price": 120.00,
"total_price": 120.00,
"taxPrice": 10,
"value": 120.00,
"transactionId": "#24356562534585"
}
Customer parameters
The parameters below can be ingested by AnyTrack and automatically forwarded to your analytics and ad pixels via server side api.
Note that prior to sending these parameters to your integrations, Anytrack process 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 |
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 map 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 | string | - | Brand name |
value | number | - | Revenue |
currency | string | Property Currency | 3 letters currency (ie. "USD" or "EUR") |
transactionId | string | - | transaction or order id |
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) |
Comments
0 comments
Please sign in to leave a comment.