- Avelon
- Avelon Support Affiliate Support
- Programmatic offline ad-hoc link creation
Programmatic offline ad-hoc link creation
To ensure we don’t create millions of links in one go, we developed ad-hoc links. Ad-hoc links do not exist in Avelon’s system until they are clicked. On first use (click) an actual affiliate link is created from the data stored in the ad-hoc link.
Our ad-hoc link pattern is below:
https://app.avelonetwork.com/api/c/${retailerPk}/${affiliatePk}/${token}
You must be approved into a retailer’s affiliate programme, otherwise the link will fail when clicked.
The ‘token’ part of the URL contains a JSON web token (JWT) which is optionally encrypted. In this example, no encryption is used. The JWT is signed by a shared secret, so no parameter spoofing is possible.
You will need to request a JWT secret before you can create your links.
Code example is below:
Map payload = [
"destination": destination, // the destination URL on your website (e.g. https://myshop.com/shoes)
"alias" : alias // link name, can be anything but cannot be empty
]
Algorithm algorithm = Algorithm.HMAC256(JWT_SECRET)
String encodedPayload = JWT.create().withPayload(payload).sign(algorithm)
String adHocLink = "https://app.avelonetwork.com/api/c/${retailerPk}/${affiliatePk}/${URLEncoder.encode(encodedPayload, StandardCharsets.UTF_8)}"
Where can I find the retailerPK?
The retailerPK is found on the end of the URL of the retailers profile. It corresponds to the retailers name on Avelon. For example, if the retailers name is Brick Caps, then their retailerPK will most likely be brickcaps.
Where can I find the affiliatePK?
The affiliatePK is your PK and can be found in the Account tab under Account information > Affiliate ID.
Contact support
If you require any help on this topic, please contact our Support Team.