Remote Synthesis
Search my blog:
Viewing By Entry / Main
May 02, 2007

Text-Link-Ads for ColdFusion and BlogCFC

At the prodding of a friend, I recently "sold out" ;) and signed up for Text Link Ads (under the sponsored links section to the left). While their site says it supports ColdFusion in the help, there is no ColdFusion code provided, so you are left rolling your own. With some help from code Todd provided me, I created a component and a BlogCFC pod for integrating Text Link Ads into your site and though this is "unofficial" code, I figured I would provide it in case someone needs it.It does differ from the official code I have seen as they usually cache your XML in a local file, but I am caching it in the application scope. It is technically ColdFusion 7 compatible, but if you need it to work on 6.1 you would just need to lose the result attribute on the cfhttp call.

Anyway, here is a snippet on how you would use the CFC - which you could use independent of the pod:

<cfparam name="url.reload" default="false" /> <cfif not structKeyExists(application,"tla") or url.reload>    <cfset application.tla = createObject("component","org.tla").init("[your key here]") /> </cfif> <!--- reload the XML at set intervals ---> <cfif dateCompare(application.tla.getLastUpdated(),dateAdd("h",-1,now())) eq -1 or url.reload>    <cfset application.tla.setInventory() /> </cfif> <!--- to simply get the straight XML simply use getInventory() ---> <cfset tlaquery = application.tla.getInventoryAsQuery() />

If you wold like to use the CFC or pod, download the attachment to this post. Anyway, now I just need someone to post a legit ad :)

Download the attachment.

Comments
mike
good on you.. the ads will come. TAL pays me about 10x what I make off of Google adsense.


Sam
Brian, I'm not seeing them?! (do they blend in that well?) =)


Joshua
Odd, they did offer CF code at one point. I have a copy I can send you if you like.


Brian Rinaldi
Sam, There is a sponsored links to the left...this had only their test link for a bit, which is gone now. Like I said, I need some legit ads. Joshua, The code that Todd sent me was based on their code (which he got from someone else who in turn got it from TLA). Anyway, I am told they *did* have CF support but pulled it for the moment and intend to put it back up. Either way, I think my version is pretty good :)


Brian Rinaldi
Ok, so Sam's comment made me realize that showing the empty pod was worthless...so I have modified the code so that the pod only shows if there is an ad to show. I will update the zip attachment as well.


Sam
They're probably still trying to figure out what your site is about so they know what ads to display. My google adsense network waaaay undersperformed last month... wondering if I should try out TLA.


Joshua
When it comes to making money with the blog this site http://www.johnchow.com/make-money-on-the-internet-april-2007/ really opened my eyes. Of course we wouldn't do all the things he does, and he has crazy traffic. Still if you look at where his money is coming from adsense is no where near the top. I am trying Kontera on my blog but find it more clutter than anything and will probably stop.


jeff
Do you know if hiding the pod violates TLA's rules?? "You must keep our script installed for your site to remain in our marketplace."


Brian Rinaldi
I would doubt it since the script *is installed* it only hides the display if there are no entries.


TJ Downes
Brian, I just finished checking yours out. Pretty cool! Basically the differences between ours is that your is a CFC, mine is a function. Your's caches to the application scope, mine caches to a file. In any case, good job! It's interesting to see how others write applications that have similar functionality so I can compare my code. If anyone else wants to check out mine you can go to http://cftextadlinks.riaforge.org/


jeff
Thanks Brian for the post about all of this. I signed up with TLA the other day and they just approved my site for ads and put it up for sale. Now I just hope they find someone that will pay $80 for an ad on my site... :)


Joshua
That reminds me. The TAL site was down yesterday (I think it was yesterday) for a bit and the code sample I got from them had no error checking. Thus it brought down my whole blog. Took me a while to find out as well. I should really dump it and move to this handy pod. ;-)


John Ramon
I getting long load times and even cfhttp time outs anyone else having that problem


Brian Rinaldi
John, I have since added a try/catch block around the cfhttp call to avoid errors when the site is down. You can also adjust the timeout of the cfhttp call within the tag to whatever is acceptable to you.


Clint
Ah darn! I signed up with TLA and didn't get approved. Not enough traffic they said. 25k mo. visitors doesn't cut it, gotta work on that.


Joshua
Clint, I see no reason why they wouldn't accept you. You should double check there were no typos in the URL submited and or contact them. Many sites use TLA that have far less traffic and Page Rank.


Brian Rinaldi
Wanted to note that the code should be updated with a try/catch block in case of TLA outages. I have had this code in place in my install, but I never updated the attachment. Here is a codeShare showing the updated function: http://codeshare.ulatu.com/sep79f4e


Write your comment



(it will not be displayed)