How to Track Clicks as Conversions in Adwords

Track Clicks as Conversions

In some cases (affiliates, third party integration) you may need to track AdWords conversions that are happening as events (clicks that are redirect visitor to athird party  websit) and not as pageview conversions. As per April 2010, Adwords is counting conversions only when a page which contains the tracking code is viewed by visitors. If you’re sending traffic to a website but the conversion is happening on another website or if there is no page that loads after users take the desired action on the website (e.g. when downloads are automatically starting on clicks on Download Now, or at clicks on installing firefox plugins) you still can count the AdWords conversions as event-based conversions. I will exemplify how to track non-page view conversions by looking at click on a Dowload Now button.

Step 1

On all pages where you want to track clicks on the Download Now button, add the following JavaScript code to the <head> section.

<script type=”text/javascript”> function setIframe() {var pitstopmedia = document.getElementById(‘psm’).innerHTML = ‘<iframe src=”tracking.html” style=”border:none;width:1px;height:1px;” marginheight=”0″ marginwidth=”0″ frameborder=”0″></iframe>’;} </script>

Step 2

Add the following onlick event to each download now link/button/image

onclick=”setTimeout(setIframe,2000);”

and right after each download link/button insert the following <div>

<div id=”psm” style=”display:none;”></div>

For example, if your initial download now link looked like

<a href=”http://www.samplesite.com/download/software.zip”> <img src=”http://www.samplesite.com/images/but-download-big.png” alt=”download” width=”234″ height=”63″ border=”0″></a>

After adding the onlclick and the div your download links should look like:

<a href=”http://www.samplesite.com/download/software.zip” onclick=”setTimeout(setIframe,2000);”><img src=”http://www.samplesite.com/images/but-download-big.png” alt=”download” width=”234″ height=”63″ border=”0″> </a> <div id=”psm” style=”display:none;”></div>

download now buttonStep 3

Create a html file called tracking.html and save it at the location specified by the iframe from Step 1 (src=”tracking.html) and paste your AdWords conversion tracking code in the file. The html file will contain just the Adwords tracking code, something similar too:

<!– Google Code for Downloads Conversion Page –>
<script>
<!–
var google_conversion_id = 10709656626;
var google_conversion_language = “en”;
var google_conversion_format = “1″;
var google_conversion_color = “ffffff”;
var google_conversion_label = “SizxCMsdstggthyQmu_T_gM”;
var google_conversion_value = 0;
if (50) {
google_conversion_value = 50;
}
//–>
</script>
<script type=”text/javascript” src=”https://www.googleadservices.com/pagead/conversion.js”>
</script>
<noscript>
<div style=”display:inline;”> <img height=”1″ width=”1″ style=”border-style:none;” alt=”" src=”https://www.googleadservices.com/pagead/conversion/1070921626/?value=5&label=SizxjkhklvqgEQmu_T_gM&guid=ON&script=0″/>
</div>
</noscript>

You’re done! If correctly implemented, the script will open an invisible iframe that contains the AdWords (or any other tracking code) at each click on the Download Now button. Since the iframe is going to load in the browser, thus generating a fake page view, your Adwords conversion code will be triggered and you should see conversions in your Adwords reports.

Pitstop Media offers ROI based internet marketing services. If you need help with PPC management or PPC optimization please contact us for a free, no obligation quote. We’ve helped companies reduce their paid advertising cost by as much as 48% and increase AdWords conversion rates by as much as 410%. See our internet marketing case studies.

VN:F [1.9.11_1134]
Rating: 9.5/10 (8 votes cast)
VN:F [1.9.11_1134]
Rating: +5 (from 5 votes)
How to Track Clicks as Conversions in Adwords, 9.5 out of 10 based on 8 ratings
 

24 Responses to “How to Track Clicks as Conversions in Adwords”

  1. Maria said:

    Jun 16, 10 at 5:56 am

    Very helpful, thanks!

    I’m wondering, though, if not the onclick is missing from your example in step 2?

    Would it look like the following? (with < instead of {)

    {a href=”http://www.samplesite.com/download/software.zip” onclick=”setTimeout(setIframe,2000);”}{img src=”http://www.samplesite.com/images/but-download-big.png” alt=”download” width=”234″ height=”63″ border=”0″}{/a}

    Also, in step 1, wouldn’t you have to replace the “var pitstopmedia = document.getElementById(‘psm’).innerHTML” with something referring to your own site?

    Thanks for your help!

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  2. TraiaN said:

    Jun 16, 10 at 8:49 pm

    thanks for correcting the error Maria. Indeed on step 2 I missed the onclick event. I will update the post at once.

    Also, in step 1 you can use whatever name you like for that variable and it doesn’t have to be related to yourwebsite name.

    VN:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  3. ps said:

    Jun 19, 10 at 8:58 pm

    just a note for noobs like me – i cut and pasted the code from the article above into my html files – BUT, all of the single and double quotemarks are “real” ones (like when you select smart quotes in your word processor) – you have to change these back into the type code expects yourself after pasting.

    i was wondering why this wasn’t working for me for 2 days now, even though analytics said people were clicking on the button. hopefully this fixes the problem for me. fingers crossed!

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  4. TraiaN said:

    Jun 21, 10 at 10:10 am

    When you copy and paste from pure html documents (which are blog is) the quotes are modified from straight quotes ” to round quotes ” which is not what you want. You need to replace all rounded quoted with straight ones, directly in a text editor (notepdad or notepad++) and then copy and paste our sample code into your documents. In the same way you need to replace ‘ and ’ with ‘.

    VN:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.11_1134]
    Rating: -1 (from 1 vote)
  5. Mikhail Silin said:

    Jul 16, 10 at 6:33 pm

    Thanks for the script, exactly what I needed.

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  6. Mikhail Silin said:

    Jul 16, 10 at 7:03 pm

    Question: will this work if I’m embedding into a paypal form which is all in form tags?

    looks something like this:

    Options
    Test $20.00
    Test 2 $25.00
    Test 3 $30.00

    I assume you put the onclick code into the image input tags… but is the only problem that results that the iframe will pop up?

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  7. Mikhail Silin said:

    Jul 16, 10 at 7:06 pm

    Sorry repost b/c the form didn’t work… set }
    {tr}{td}{input type=”hidden” name=”on0″ value=”Options”}Options{/td}{/tr}{tr}{td}{select name=”os0″}
    {option value=”Test”}Test $20.00{/option}
    {/select} {/td}{/tr}
    {/table}
    {input type=”hidden” name=”currency_code” value=”USD”}
    {input type=”image” onClick=”TTSPaypal()” src=”https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif” border=”0″ name=”submit” alt=”PayPal – The safer, easier way to pay online!”}
    {img alt=”" border=”0″ src=”https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif” width=”1″ height=”1″}
    {/form}

    I assume you put the onclick code into the image input tags… but is the only problem that results that the iframe will pop up?

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  8. TraiaN said:

    Jul 19, 10 at 1:29 pm

    Mikhail, did you test the implementation already? The iframe should not open, since it has a display:none attribute in css. let me know if it worked.

    VN:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.11_1134]
    Rating: +1 (from 1 vote)
  9. Mikhail Silin said:

    Jul 21, 10 at 8:16 pm

    The iframe didn’t open but Google didn’t count the conversion either. Back to the drawing board.

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  10. TraiaN said:

    Jul 21, 10 at 9:49 pm

    add event tracking on the same link, using Google Analytics and see if clicks are tracked.

    VN:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  11. Mikhail Silin said:

    Jul 23, 10 at 4:50 pm

    I figured out the problem – when I copied your source code, there is a space in step one between src and =, which I didn’t delete. Stupid mistake. It works fine now. Thanks for this! It will help my tracking immensely.

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  12. TraiaN said:

    Jul 23, 10 at 6:01 pm

    Thanks, I’ve removed the space now. Sometime yes, you get big headaches from small issues.

    VN:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  13. Adam said:

    Aug 19, 10 at 9:41 pm

    If there is more than 1 link on a page, does the still need to appear after each or could it appear once at the end of the page?

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  14. TraiaN said:

    Aug 20, 10 at 10:55 am

    yes, if you need to track multiple links, you will have to add the onclick event to all href anchors

    VN:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  15. Patrick said:

    Aug 27, 10 at 7:17 am

    Interesting approach to tracking links as conversions in Adwords. I’ve got a question about using this along with regular GA event tracking.

    Say I’ve got an outbound link that I need tracked in GA, but that we also have an Adwords conversion set on this outbound URL (so it gets counted a a click to that URL and also gets counted as someone coming to the site via Adwords and clicking on that URL).

    How would you implement both? Is that possible?

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  16. TraiaN said:

    Aug 27, 10 at 11:33 am

    Patrick, it is possible. The javascript will call 2 functions the event tracking for GA and the iframe. This is what we use for one client of us

    This way we track events in Google Analytics and conversions in AdWords.

    VN:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  17. The Flower Guy said:

    Dec 31, 10 at 3:08 pm

    I created a jquery plugin a while back that does this and (IMHO) is a little simpler. see http://favcode.net/browse/jquery_plugin_for_google_adwords_conversion_tracking for the plugin code and an example of usage.

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: -1 (from 1 vote)
  18. Siku-Siku said:

    Jul 07, 11 at 10:06 pm

    Thanks for the detailed workaround.

    For the step #2, we might want to apply the setTimeout on when the browser should follow the link (i.e. not on the setIframe function). Basically, we want to make sure the setIframe function completes its execution before following the link.
    Reference: http://bit.ly/pfAHFl

    The code above doesn’t prevent the browser to immediately follow the link. Thus, there is a chance that setIframe function doesn’t get executed.

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  19. TraiaN said:

    Jul 08, 11 at 9:56 am

    thanks for the comment. I’ve tried setTimeout, but for some reason I was not able to get it working

    VN:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  20. Bruno said:

    Jul 19, 11 at 10:53 am

    If you are using google analytics you could also just track clicks as events, make events goals and do the GA to AdWords goal import.

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  21. TraiaN said:

    Jul 19, 11 at 11:14 am

    yes, you could do that, but then you will have to deal with different cookie lives.

    VN:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  22. Christian Due said:

    Nov 08, 11 at 3:07 am

    Dear TriaN

    It’s just what i have been looking for :) I need it for both adwords and A/B test tracking but I just can’t get it to work. (Only trying adwords right now)

    Can you look through it for me?

    I implemented it here:
    http://super-abonnementer.dk/iphone-4s-kob

    On the first button on the right side saying “til butik”

    Looked though it a couple of times and just can’t figure it out.
    My iframe is here: http://super-abonnementer.dk/tracking.html

    Thanks
    Christian

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  23. TraiaN said:

    Nov 10, 11 at 4:29 pm

    Christian, I don’t the the onClick event on your anchor.

    VN:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.11_1134]
    Rating: 0 (from 0 votes)
  24. Alan said:

    Dec 02, 11 at 5:37 am

    I was wondering whether it woudl work calling the ‘call’ code that is generated by Adwords if you select ‘call’ rather than webpage. My Javascript is a bit basic, but it appears it might do the job.

    /* */

    VA:F [1.9.11_1134]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.11_1134]
    Rating: 0 (from 0 votes)

Leave a Reply