PPC Conversion Tracking using Javascript

PPC Conversion tracking (Google/Yahoo/MSN) is straightforward for simple HTML websites. You place the conversion pixel on the thank you page. But when you have conversions in Flash sites or when the page is not reloaded after a conversion in the case of an ajaxed site, firing the conversion pixel is not as simple.

I created a simple javascript function that will include the tracking pixel as an iframe in the current page. All you have to do is change the url to the tracking pixel and then call the conversion function from your page or flash file.

function conversion() {
   
    var iframe = document.createElement('iframe');

    iframe.style.width = '0px';
   
    iframe.style.height = '0px';
   
    document.body.appendChild(iframe);
   
    iframe.src = 'http://wwww.domain.com/pixel.html';

};

  • Digg
  • TwitThis
  • del.icio.us
  • Netvouz
  • description
  • Reddit
  • Furl
  • NewsVine
  • Simpy
  • Slashdot
  • Spurl
  • StumbleUpon
  • YahooMyWeb
  • TailRank
  • Technorati
  • Facebook
  • Google
  • LinkedIn
  • Live
  • MySpace
  • Ping.fm
  • Yahoo! Buzz
  • E-mail this story to a friend!



Home | JavaScript | PPC Conversion Tracking using Javascript