Parameter name: request
Error in deserializing body of reply message for operation 'Translate'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 8703.
Here is a simple ClickBank tracking script written in PHP that you can install on any of your websites free of charge. It can be used to track sales from AdWords and sales from EzineArticles and other article directories.
Installation is simple, just copy the index.php file shown below (after modifying it slightly) up to your web hosting service. If you’re doing EzineArticles-friendly domain serving, install it in the root of the server, otherwise you can just create a new folder and install it there. For example, I might create a folder called “burnthefat” and place the index.php file in there. Any subsequent access to “http://www.mydomain.com/burnthefat/” would invoke the script and do a redirection.
Before uploading the script, be sure to modify the default $affiliateid and $vendorid values. They are currently set to ‘egiguere’ (my primary CB affiliate ID) and ‘burnthefat’ (the vendor ID for Burn the Fat, Feed the Muscle). Set them to appropriate defaults. You can override these settings when invoking the script. (If you’re planning on using the domain with EzineArticles, you MUST set the affiliate and vendor ID values correctly because you can only link to the root of the URL with no parameters.)
Now this is totally optional, but you may also want to add these lines to a .htaccess file that you place in the same directory as the index.php file:
These lines ensure that no one can download the .csv files the script creates — you’ll have to fetch them yourself using an FTP client. (Like I said, optional…)
The script looks at the referrer header and tries to build a tracking ID that incorporates part of the domain name and some kind of unique identifier. For EzineArticles, for example, it uses the “id” field (the article identifier). So you can easily tell which article of yours generated the click. It looks for “id”, “C” (which is used by GoArticles) and “kw”. You can easily modify it to look for other things.
The tracking ID generated in these cases consists of the date and time (in MMDDHHSS format — 8 characters long, i.e. “03091347?), some portion of the domain name (i.e. “ezineartic”), and the article ID (i.e. “672234?). So when you see this show up in your ClickBank report:
03091347ezineartic672234you’ll know the click came on 13:47 on March 9 from EzineArticles article #672234.
The script has some built-in features for tracking AdWords clicks, but only if you use a special syntax in your destination URLs, like so:
http://www.yoursite.com/?ag=rf01&nw={ifsearch:s}{ifcontent:c}&kw={keyword:none}&pl={placement}This is what the values mean:
ag — an identifier for the ad group or whatever unique thing you want to track, i.e. if you have two different ad texts you might want to assign two different values herenw — the network being used. Note the special “{ifsearch:s}{ifcontent:c}” syntax. On the search network, the value will end up being “nw=s”, on the content network it will end up being “nw=c”. This is how you tell where the click comes from.kw — the keyword that triggered the ad, if known, or “none” if not known.pl — the website the ad was featured on if it’s shown on a third-party site.As you see, you can pack a lot of information into the destination URL. The script will store all this information in the CSV files it creates and it will use it to create a tracking ID. The tracking ID will start with the date (MMDDHHSS as before) followed by “aw” (for “AdWords”), followed by one character for the network (“s” for search, “c” for content, “u” if unknown), followed by the ad group (the “ag” value), followed by as much of the keyword (the “kw” value) as will fit. (Tracking IDs are limited to 24 characters, remember.)
If the script doesn’t have enough information to create a (semi)human-readable tracking ID, it generates a random number and prefixes it with the date (in MMDDHHSS format) and uses that as the tracking ID.
You can set the affiliate ID and vendor ID explicitly by using the “affiliateid” and “vendorid” query parameters, as in:
http://www.feedthemuscleburnthefat.com/?vendorid=4idiotsThis is useful if you want to use the same script for multiple redirections.
The tracking IDs the script creates are meant to be easily eyeballed in the ClickBank sales report. But if you want to know more about the context of a particular tracking ID, the script stores information in simple CSV (comma-separated value) files that you can easily download and load into a spreadsheet application like Microsoft Excel. A separate file is created for each day, so the clicks for March 8, 2010 are found in “clicks.2010-03-08.csv”, in the same folder as the index.php file.
So when you see a click in your ClickBank sales report and you want to know more about it, look at the first 4 characters of the tracking ID to extract the month and day to know which file to download and open in Excel. The following data is stored, in this order:
The full date and timeThe tracking IDThe final affiliate IDThe visitor’s IP addressThe full path that was requested, including any parametersThe referrer URL, if anyThe user-agent header, if any (useful for discerning robots from humans)Here it is. Either download this text file or copy the text below; place the text into a file called index.php and copy it up to your webserver.
0 ){ $domain = $hostparts[$tld-1]; $ids = array( 'id', 'C', 'kw' ); foreach( $ids as $param ){ if( !empty( $params[$param] ) ){ $source = makealphanum( $params[$param] ); } if( $source ) break; } if( !empty( $source ) ){ $tid = $prefix . substr( $domain . $source, -16 ); } }}// Last resort: we weren't able to create a tracking ID, so// generate a unique string to server as our ID.if( empty( $tid ) ){ $tid = substr( getfaketid( $prefix ), 0, 24 );}$afflink = 'http://' . $affiliateid . '.' . $vendorid . '.hop.clickbank.net/?tid=' . $tid . $extra;header( "Location: $afflink" );// Write out the data to our CSV file$fp = fopen( $logfile, 'a' );if( $fp ){ fputs( $fp, logmsg() ); fclose( $fp );}//*************************************************************// Functions used by the code above...//*************************************************************// Convert the string to a lower case alphanumeric-only stringfunction makealphanum( $str ){ return ereg_replace( '[^a-z0-9]', '', strtolower( urldecode( $str ) ) );}// Parse a query string into its constituent partsfunction parse_query( $var ){ $var = html_entity_decode( $var ); $var = explode( '&', $var ); $arr = array(); foreach( $var as $val ){ $x = explode( '=', $val ); $arr[$x[0]] = $x[1]; } unset( $val, $x, $var ); return $arr;}// Encode URLs for saving in the CSV file by converting// quotes and commas to URL escapes.function csvencode( $str ){ $str = str_replace( '"', '%22', $str ); $str = str_replace( ',', '%2C', $str ); return $str;}// Create the line of CSV data to append to the log filefunction logmsg(){ global $request; global $ip; global $referrer; global $browser; global $tid; global $reqtime; global $afflink; $msg = "$reqtime,$tid,$afflink,$ip," . csvencode( $request ) . "," . csvencode( $referrer ) . "," . csvencode( $browser ); return $msg . "\n";}// Generate a fake TID with the given prefix.function getfaketid( $prefix ){ return uniqid( $prefix );}?>OK, user-friendly this isn’t, I admit it. It’s very geeky. But if you’re even a bit technically inclined you should be able to install this script and use it. If you have questions about it, please leave them as comments here rather than mailing me, it’ll be more useful for others.
March 9, 2010 | Filed Under AdSense
No comments:
Post a Comment