Why Third-Party Shorteners Can Be Problematic
When using third-party URL shortening services like Short.io, there is a risk of scripts being stopped if the API responds with a non-200 status code. This can lead to a lack of visibility into errors and make it difficult to troubleshoot issues.
Building a Custom URL Shortener
Building a custom URL shortener can help mitigate these issues. By hardcoding shortened links, there are no failures at the time of send, and potential blockage issues that may arise from using third-party services in SMS can be avoided.
The root cause of the issue is the reliance on third-party services for URL shortening, which can lead to a lack of control over error handling and logging.
Benefits of a Custom Shortener
In addition to avoiding potential issues with third-party services, building a custom URL shortener can also provide valuable insights into user behavior. By tracking pass-through data, marketers can gain a better understanding of how users interact with their content.
example.ssjs
var shortener = Platform.Function.CreateObject("URLShortener");
var shortenedUrl = shortener.shorten("https://example.com/long-url");
Implementing a Custom Shortener
To implement a custom URL shortener, marketers can use Server-Side JavaScript (SSJS) to create a function that shortens URLs and logs errors to a data extension.
Checklist for Implementing a Custom Shortener
- Create a new SSJS function to shorten URLs
- Use a data extension to log errors and track pass-through data
- Test the custom shortener with different URL lengths and types
- Implement error handling to log non-200 status codes
- Monitor and analyze pass-through data to gain insights into user behavior
What are the benefits of building a custom URL shortener?
Building a custom URL shortener can help mitigate potential issues with third-party services, provide valuable insights into user behavior, and give marketers more control over error handling and logging.
How can I track pass-through data with a custom shortener?
Marketers can use a data extension to log pass-through data and gain insights into how users interact with their content.
What is the best way to handle non-200 status codes with a custom shortener?
Implementing error handling to log non-200 status codes can help marketers troubleshoot issues and gain visibility into errors.
Can I use a custom shortener with other marketing channels?
Yes, a custom URL shortener can be used with other marketing channels, such as email and social media, to provide a consistent user experience and track user behavior across channels.
Need help shipping this in production?
Genetrix builds and untangles Salesforce Marketing Cloud and Agentforce setups for teams that want it done right the first time. If anything in this post sounds familiar, talk to us before it ships.