Link Tracking Template
Link tracking enables businesses to track the number of clicks happened on any CTA button(URL only). This would help them aesthetically and with better analytics.
To track the clicks happened on any weblink, the businesses must send the template messages with dynamic CTA option only, on which they can embed the weblink so that clicks can be tracked on the same.
When sending dynamic CTA message through API, business must pass the 'longUrls' in the metadata field for which they want to track the clicks.
The creation of 'ShortURLs' will be done at Sinch’s end and the 'ShortURLs' will be passed as the parameter of the dynamic CTA.
We previously supported single link tracking for tracking a single URL. However now, we are introducing multiple link tracking to give businesses more flexibility and enhance their tracking capabilities.
The previous payload format allowed businesses to track clicks on a single URL embedded in a dynamic CTA message. The longUrl field in the metadata was used to pass the URL, and the creation of the shortened URL (ShortURL) was handled by Sinch.
Old Payload
{
"recipient_type": "individual",
"to": "<recipient_mobile_number>",
"type": "template",
"template": {
"name": "<template_name>",
"language": {
"policy": "deterministic",
"code": "<template_language_code>"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "text",
"text": "PayNow"
}
]
},
{
"type": "button",
"index": "0",
"sub_type": "url",
"parameters": [
{
"type": "text",
"text": "PayNow"
}
]
}
]
},
"metadata": {
"trackingCta": {
"target": "<longUrl>",
"tags": {
"appID": "<appId>",
"MSISDN": "<recipient_mobile_number>",
"campaign": "<campaign_name>",
"template": "<template_name>",
"key1": "<value>" // Custom metadata key-value pair
}
}
}
}
Notice: In future releases, the old payload with target field inside the metadata will be deprecated . Please use the new format (described below) for tracking single or multiple links.
New Payload
{
"recipient_type": "individual",
"to": "<recipient_mobile_number>",
"type": "template",
"template": {
"name": "<template_name>",
"language": {
"policy": "deterministic",
"code": "<template_language_code>"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "text",
"text": "PayNow"
}
]
},
{
"type": "button",
"index": "0",
"sub_type": "url",
"parameters": [
{
"type": "text",
"text": "PayNow"
}
]
},
{
"type": "button",
"index": "1",
"sub_type": "url",
"parameters": [
{
"type": "text",
"text": "PayNow"
}
]
}
]
},
"metadata": {
"trackingCta": {
"targets": [
"longURL1",
"longURL2"
], // <tracking_urls>
"tags": {
"appID": "<appId>",
"MSISDN": "<recipient_mobile_number>",
"campaign": "<campaign_name>",
"template": "<template_name>",
"key": "value" // Custom metadata key-value pair
}
}
}
}
Dynamic Fields for Link Tracking
| Placeholder | Example | Description |
|---|---|---|
<recipient_mobile_number>String | +919000000000 | Recipient's mobile number |
<template_name>String | marketing_template | Name of the template |
<template_language_code>String | en | Supported language code to the corresponding template |
<appId> String | wenszx12 | ID passed by the enterprise |
<campaign_name> String | SummerSale2025 | Name of the campaign |
<longUrl> | https://www.ex.com | Long URL to be tracked |
<tracking_urls> | ["https://www.ex.com", "https://www.ex.com"] | Array of Urls to be tracked(upto 2) |
- For
trackingupload a single button of sub_type :URLalong with thelongURLintargetsArray insidetrackingCTaas below :{"targets": ["longURL"]} - If the card have multiple button with sub_type:
URL, fortrackingupload twolongURLintargetsArray insidetrackingCTaas below :{"targets": ["longURL1","longURL2"]}
Note: These are the dynamic entries that you will need to replace with actual values when sending the API request. You can update these fields based on the message you want to send.
Note:- In order to use the feature of click tracking, businesses need to first create a template with dynamic CTA options on SmartTA platform, mention a pre-defined link in the CTA option and use that template only while sending messages through API.
In case the enterprises do not want to track the clicks on any link – than they can send the messages without any metadata object in the payload.