One of our clients an electronic entertainment company provides movie trailers on their site. They also want to provide their partners with a simple EMBED tag for a flash player similar to what youtube does with it videos. Naturally they want to be able to track how often the movie clip or trailer is viewed on their partners sites by using google analytics, or as yet to be determined tracking methods.
Naturally it's dead easy to do in coldfusion requiring only cfhttp and cfcontent tags to make the google analytics call and serve the digital content. I took the example php code and converted it to CFML and set it to return a customized flash player.
<cfset var_utmac='UA-0000000-0'> <!--- enter the new urchin code --->
<cfset var_utmhn='www.mysite.com'> <!--- enter your domain --->
<cfset var_utmn=RandRange(10000000,99999999)> <!--- random request number --->
<cfset var_cookie=RandRange(10000000,99999999)> <!--- random cookie number --->
<cfset var_random=RandRange(1000000000,2147483647)> <!--- number under 2147483647 --->
<cfset var_today=now()> <!--- today --->
<cfset var_referer=#cgi.HTTP_REFERER#> <!--- referer url if it exists --->
<cfset var_uservar='-'> <!--- enter your own user defined variable --->
<cfset var_utmp= ''> <!--- this example adds a fake file request to the (fake) tracker directory (the image/pdf filename). --->
<cfhttp method="get" url="#urchinURL#" throwonerror="false"/>
<cfcontent type="application/x-shockwave-flash" file="#fileToReturn#" reset="false">
Worked like a charm, and as the other php examples show you can set it to work for other content as well.
No recent entries.