Introduction:

In today's digital marketing landscape, tracking the performance of marketing campaigns is crucial to understanding their effectiveness and making data-driven decisions. One popular way to track these campaigns is through the use of UTM parameters, which allow marketers to monitor how specific sources, mediums, and content contribute to their overall results. However, adding UTM parameters to URLs can make them lengthy and unattractive, especially when used in SMS messages where character limits and readability are important factors. To overcome this issue, marketers can use link shortening services like Short.io to create shorter, branded URLs with embedded UTM tracking parameters.

In the following guide, we will demonstrate how to integrate Short.io with Salesforce Marketing Cloud (SFMC) to generate shortened, tracked URLs for use in SMS messages.

Solution:

Create a new Content Block in SFMC and add the following script:

%%[
Var @FINALURL
]%%
<script runat="server">
Platform.Load("core", "1");
var url = 'https://api.short.io/links';
var contentType = 'application/json';
var data = {
   "tags":[Variable.GetValue("@shortTag"),Variable.GetValue("@shortTag2"),Variable.GetValue("@shortTag3")],
   "allowDuplicates": false,
   "domain": "go.example.com",
   "originalURL": Variable.GetValue("@FINALURL")
}
var payload = Stringify(data);
var headerNames = ["Accept", "Authorization"];
var headerValues = ["application/json", "API_KEY_HERE"];
var result = HTTP.Post(url, contentType, payload, headerNames, headerValues);

var resp = Platform.Function.ParseJSON(String(result.Response));
Write();

Variable.SetValue("@SHORTCODE", resp.path);

</script>

Replace "API_KEY_HERE" with your Short.io API key.

In the SMS message content, include the following AMPScript code:

%%[
var @shortTag, @shortTag2, @shortTag3, @campaign, @content, @url, @finalUrl
SET @url = "https://www.example.com/landing-page/free-shipping-tuesday"
SET @campaign = "EXAMPLE_CAMPAIGN_NAME"
SET @content = "EXAMPLE"
SET @shortTag = "TAG1"
SET @shortTag2 = "TAG2"
SET @shortTag3 = "TAG3"

SET @finalUrl = CONCAT(@Url,"?utm_medium=sms&utm_source=SMS&utm_campaign=",@campaign,"&utm_content=",@content)
]%%
%%=ContentBlockbyId('BLOCK_ID_HERE')=%%

Replace 'BLOCK_ID_HERE' with the Content Block ID of the Content Block you created in step 1.

This will insert the shortened link with appropriate UTM parameters into your SMS message. Ensure that you have configured your Short.io API key, and that you are using the correct domain name for your shortened links.

Conclusion:

By integrating Short.io with SFMC, marketers can easily create shortened URLs with embedded UTM tracking parameters for their SMS campaigns. This approach not only preserves the character limit and readability of the SMS messages, but also ensures that each click on the link can be accurately tracked and attributed to specific campaign elements. In turn, this data-driven approach enables marketers to optimise their campaigns and make better-informed decisions about their marketing strategies.

Tags:

SSJS, Shortio, Marketing Cloud, AMPscript