So in the hunt for doing some cool auto-tweeting and other social mashup related tricks, I found this amazing new service (currently in public beta) called dlvr.it. I’ll post more on this tool at a later time, but for now, I want to explain how I managed to use their API to create an custom affiliate link shortener for YogaHub.
It all stemmed from the constant need for affiliates to be able to create their own custom redirect links (which many services have already.)
I wanted to create something both elegant, yet simple to use and easy to understand, because many of the affiliates in the health and wellness space are new to the concepts of affiliate programs and doing a lot of fancy footwork with links isn’t their strong suit.
So essentially, the click.php page is looking for a ‘desturl’ to redirect the visitor to once the affiliate cookie has been established.
So I setup a basic web form in php to first ask the user (the affiliate) where they want to send the traffic to (aka, what web page on the Network of YogaHub sites.)
Next, I pass this URL variable to step 2 of my php script, along with their [AffID] which I’ve already established because in order to use the tool, the user must first be logged into their affiliate account.
Then for security measures and to ensure everything is working, I have the affiliate double confirm their affiliate ID and then press the ‘Confirm ID & Create Short Link’ button.
From here, I then post the fully encoded PAP link directly to the dlvr.it API via a plain text post method and they shoot me back a nifty little short link like this:
And finally, with a few quick DSN CNAME changes I was able to map my own custom URL producing a sweet affiliate link such as:
As far as I can tell, there’s no limits to the number of API calls I can make and with this community I don’t think we’d come close in either case.