Mike On Ads » rmx direct http://www.mikeonads.com Ramblings about online advertising, ad networks & other techie randomness Fri, 18 Nov 2011 00:07:32 +0000 en hourly 1 http://wordpress.org/?v=3.2.1 How to get informative feedback on ads from your users http://www.mikeonads.com/2007/04/22/how-to-get-informative-feedback-on-ads-from-your-users/ http://www.mikeonads.com/2007/04/22/how-to-get-informative-feedback-on-ads-from-your-users/#comments Mon, 23 Apr 2007 02:29:16 +0000 Mike http://www.mikeonads.com/2007/04/22/how-to-get-informative-feedback-on-ads-from-your-users/ For publishers one of the must frustrating aspects of dealing with ad-networks is probably the powerless feeling you get when one of your user’s complains about a particularly offensive, annoying or suggestive ad that they just saw. So what can you do? Here’s a quick and easy method to provide a “report this ad” button for your site.
Here’s the normal process of ad call:
– You put a tag on your page, script src=”some.adserver.com/someparameters”>
– Browser requests javascript, and it returns something like — document.write(‘‘);
– User sees some.ad.com/ad.jpg

So how do you create a button to ‘report an ad’? Simple! You simply create a wrapper function around document.write() to capture all the output. Then, all you need to do is a little bit of smart javascript and badabing you’re done! Credits to this page for the document.write JS;.

So how do you wrap document.write()? Rather easily! Check it out this IE specific example:

(function(){
        var documentWrite = document.write ;
        var createWrapper = function(s){
                writeOutput = writeOutput + "\\n\\n" + s;
                return s;
        };

        document.write = function(s){
               documentWrite(createWrapper(s) );
               document.close();
        }
})();

As you can see this is remarkably simple. Every time document.write() is called we simply append the call to a variable ‘writeOutput’, which you can then do whatever you want with. I’ve created a fully functional example that has the full browser compatible javascript. It takes the writeOutput from an RMX Direct tag and puts it in a textarea at the top. You can grab the javascript by just viewing the source. The PHP code for “report_ad.php” is extremely simple:

$adcontent = htmlentities($_POST["adcontent"]);
$report = htmlentities($_POST["addetails"]);

echo "<b>Here is the email you send yourself:</b><br><br>\n";

echo "<b>Subject:</b> Uhoh, someone reported an ad!<br>\n";
echo "<b>User Comments:</b> $report<br><br> Here is what happened on the page when the user saw the ad:<br><br>\n";

Now, it’s important to realize that this isn’t a perfect way to do it. If the advertiser is wrapping content in an IFRAME then this method will simply show you the IFRAME source. Also, I’m not sure this will work for all networks. I’ve tested it with RMX Direct and Fastclick/Valueclick and it seems to work for both. In the document.write() output you can clearly see the source for the flash files being served. In any case, I hope this will be useful to somebody.

]]>
http://www.mikeonads.com/2007/04/22/how-to-get-informative-feedback-on-ads-from-your-users/feed/ 2