Is there a possibility to export or generate a report for bitly link sent through SMS with mobile connect?
Thanks in advance
No, there is no possibility to track OOTB Bit.ly shortener within Mobile Connect, however, as an alternative, you can shorten your links via API calls saved in the Code Snippet and simply bring it to the SMS text by %%=ContentBlockByID(...)=%%
The code snippet would contain -
<script language="javascript" runat="server">
Platform.Load("Core", "1");
try{
</script>
%%[
VAR @Link, @utm_campaign, @utm_source, @utm_medium, @utm_id, @sfmc_id, @Parameters, @FullURL, @AccessToken, @Payload, @PostRequest, @Response, @ResponseRows, @json, @ShortenURL
/* Set the link and parameters you want to track */
SET @Link = ""
SET @utm_campaign = ""
SET @utm_source = ""
SET @utm_medium = ""
SET @utm_id = ""
SET @sfmc_id = ""
/* Prepare your full link */
IF NOT EMPTY(@Link) THEN
IF EMPTY(@utm_campaign) AND EMPTY(@utm_source) AND EMPTY(@utm_medium) AND EMPTY(@utm_id) AND EMPTY(@sfmc_id) THEN
SET @FullURL = URLEncode(CONCAT('"', @Link, '"'))
ELSE
SET @Parameters = CONCAT("?utm_campaign=", @utm_campaign, "&utm_source=", @utm_source, "&utm_medium=", @utm_medium, "@utm_id=", @utm_id, "&sfmc_id=", @sfmc_id)
SET @FullURL = URLEncode(CONCAT('"', @Link, @Parameters, '"'))
ENDIF
ENDIF
/* Change 'xxx' to your personal access token */
SET @AccessToken = 'xxx'
/* Change 'xxx' to the Group ID this link would be associated with and 'yyy' to either default 'bit.ly' domain or your custom one */
SET @Payload = CONCAT('{"group_guid": "xxx", "domain": "yyy", "long_url": ', @FullURL, '}')
SET @PostRequest = HTTPPost2("https://api-ssl.bitly.com/v4/shorten", "application/json", @Payload, False, @Response, @ResponseRows, "Authorization", CONCAT("Bearer ", @AccessToken))
IF @PostRequest == '200' THEN
SET @json = @Response
ENDIF
]%%
<script language="javascript" runat="server">
/* Receieving json from POST request and parsing it to get the link */
var json = Variable.GetValue("@json");
var ParseJSON = Platform.Function.ParseJSON(json);
var ShortenURL = ParseJSON.link;
Variable.SetValue("@ShortenURL", ShortenURL);
}catch(e){
Write(Stringify(e));
}
</script>
However, to make it work, you would need to get in advance several things:
Other points to consider: