Dynamic Short Links and Referral Tracking

Many app and website owners let customers invite their friends to the product, hoping to achieve an organic uplift. Growth teams want to track these invites and measure their impact on the overall growth, while also answering questions such as:

  • Which users drive the most amount of invites?
  • How can we acquire more users like them?
  • Who should the credit for the invite go to (when relevant)?

With Singular's infrastructure, inviting someone to the app is as simple as sending them a link. But we want to append some data on top of that link (e.g., the user ID of the referring user), and also shorten it so that the information remains private, secure, and unchanged. Shortening also prevents the link from becoming too long and unappealing to users.

The Dynamic Short Links API lets you transform long, parameter-filled Singular Links into shorter, secure and appealing links:

Before:
https://my.sng.link/Dappid/linkid?referring_user_id=123&referring_user_name=john&channel=sms
After:
https://my.sng.link/Dappid/linkid/r_hiuxchas8h

Note:

  1. Once created, short links remain active for 30 days.
  2. The Dynamic Short Links API works for both type of Custom and Partner Integrated tracking links. However, it is mainly used for custom type of links for Referral or Influencer campaign tracking.

Creating Dynamic Short Links

1

Create a Singular Link

Go to Attribution > Manage Links and create a new link. See the Singular Links FAQ for help.

2

Add Parameters to the Link

Once you have the link URL, we recommend appending the following parameters. The data you add will be made available to you in reports or exports.

URL parameter Description Included in reports? Included in Data Destinations (ETL)?
pcn Campaign Name Yes Yes
referring_user_id Your user ID for the referring user No Yes
referring_user_name Your name for the referring user No Yes

The result may look as follows:

https://my.sng.link/Dappid/linkid?referring_user_id=123&referring_user_name=john&pcn=mycampaign
3

(Optional) Add Custom Passthrough Information to the Link

You can pass additional information to your app through the tracking link using the "_p" parameter. This parameter can accept a string or a JSON object (as long as it's URL-encoded).

For example, say you want to pass the following dynamic information to your app through the tracking link:

{
“productid”:”Shoes123”,
“qty”:1
}

You can URL-encode it and append it to the _p parameter in your tracking link:

https://myshoppingapp.sng.link/A59c0/nha7?_p=%7B%22productid%22%3A%22Shoes123%22%2C%22qty%22%3A1%7D
4

Retrieve Your Singular SDK KEY

Retrieve your Singular SDK Key by going to "Developer Tools > SDK Integration > SDK Keys" and copying the value next to "SDK Key".

Screen_Shot_2022-10-11_at_15.30.07.png

5

Create One or More Short Links

Use the Dynamic Short Links API endpoint to create a short link.

Note:

  • The endpoint is https://s2s.singular.net/api/v1/s2s/shorten_link?a=<SDK KEY> where <SDK KEY> is the key you retrieved in the previous step.
  • In the JSON parameters, pass the URL you want to shorten.
  • Once created, short links remain active for 30 days.
Endpoint https://s2s.singular.net/api/v1/s2s/shorten_link?a=<SDK KEY>
Method POST
JSON Body
{"long_link": "<LONG LINK>"}

For exmaple:

{"long_link": "https://my.sng.link/Dappid/linkid?referring_user_id=123&referring_user_name=john&channel=sms"}
Response

The response (in JSON format) contains a shortened link:

{"short_link": "https://my.sng.link/Dapp/linkid/r_ninja123"}