External ID as Click ID

Learn how you can leverage External ID from third party platforms to track conversions in AnyTrack.

AnyTrack allows you to use an External ID instead of the AnyTrack Click ID to track server side conversions. This method enables you to stitch literally any third party data with the Anytrack dataset.

Use cases:

  • You use a marketing platform ex: Hubspot that doesn't let you pass a click_id into their forms.
  • You can't modify your forms or the form is generated programmatically via JS code.
  • The platform where conversions are triggered doesn't send custom fields in their webhooks.

❗️

Caution

This guide requires javascript skills or the ability to use Google Tag Manager to capture variables, cookies or event data from the browser. If you're not comfortable with coding, please forward this article to a developer or contact us in order to be referred to a developer.

Why it matters:

Let's say that the platform where your conversions are triggered isn't natively integrated with AnyTrack, and that it does not accept any custom parameters (such as the AnyTrack clickid).

In such case, you need to find an identifier from the third party platform that will be both set on the browser (ex: a cookie, leadid, userid, email) and via the platform's webhook.

👍

Reminder about Server Side Tracking

Server-side tracking is only possible when AnyTrack has collected or passed an identifier that your platform can collect and return to AnyTrack via their webhook endpoint.

Example with regular 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.

AnyTrack('trigger', 'AddToCart', {
	customId: 'e.clickId',
	cartId: '{{cartId}}',
	value: '{{cartValue}}',
	currency: '{{currency}}',
	items: [{
		id: '{{skuId}}',
		price: '{{price}}',
		quantity: '{{quantity}}',
		name: '{{itemName}}'
	}],
	token: '{{cartToken}}'
});

Example with an External ID:

During the AddToCart event AnyTrack records a click_id and alias it with the cartId using the parameter refId.

Logically, it works like this:

click_id=refId=cartId

So when the platform calls the anytrack webhook, AnyTrack can parse the cartId and tie it to the click_id that triggered the AddToCart event.

event click_id with the cartId, and during the Purchase event, the platform returns the cartId in the webhook payload.

AnyTrack('trigger', 'AddToCart', {
	refId: '{{cartId}}',
	cartId: '{{cartId}}',
	value: '{{cartValue}}',
	currency: '{{currency}}',
	items: [{
		id: '{{skuId}}',
		price: '{{price}}',
		quantity: '{{quantity}}',
		name: '{{itemName}}'
	}],
	token: '{{cartToken}}'
});

Setup guide:

  1. Trigger an event via the AnyTrack Event Snippet

This step requires some javascript skills or the ability to use Google Tag Manager to capture variables, cookies or event data from the browser.

If you're not familiar with Javascript you should ask for a developer to implement this method for you.

AnyTrack('trigger', 'AddToCart', {
	refId: '12831238',
	cartId: '12831238',
	value: '200',
	currency: 'USD',
	items: [{
		id: '111',
		price: 200,
		quantity: 1,
		name: 'Tesla'
	}],
	token: 'asdasdjkasdj'
});

When this event snippet loads, it will automatically Alias the Anytrack Click_id with the refId value (1929195592). The data is sent to the Anytrack server and will be used when the third party platform sends conversions via api / webhook.

You can send additional parameters with this event following the event parameters guide.

  1. Create a custom integration

Navigate to the integration catalog and create a custom integration.

Upon saving, the system will issue the webhook (also called postback url)

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

Depending on how the third party system formats its webhook payload you will probably have to use zapier or integromat to remap the parameters to match the AnyTrack standard parameters.

Please follow the instructions: How to send Conversions from AnyTrack to Zapier to create your zap.

Eventually, you will want to fire the conversion following the format below, where the refid carries the parameter initially captured during the first step.

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

{
    "event_name": "Purchase",
    "email": "[email protected]",   
    "refId": "12831238",
    "fullName": "Elon Musk",
    "address": "Milky Way 1",
    "phone": "+1919875666",
    "country": "Space",
    "items": [{
      "id": '111',
			"price": 200.00,
			"quantity": 1,
			"name": 'Tesla'
    }],
    "currency": "USD",
    "id": "24356562534585",
    "subtotalprice": 200.00,
    "totalprice": 200.00,
    "taxPrice": 10.00,
    "value": 200.00,
    "transactionId": "#24356562534585"
}