How to Track Clicks as Conversions in Adwords

conversions-adwords

In some cases (i.e. affiliates) you may need to track AdWords conversion events (i.e. clicks that redirect visitors to a third party website) rather than page view conversions. As per April 2010, AdWords is able to count conversions only when the page which contains the conversion tracking code is viewed by visitors.

If the final conversion you need to track happens on a website (where you don’t have control over), or if there is no page view triggered after the users take the desired action (i.e. when the downloads start automatically at clicks on a Download Now button) you still can count the AdWords conversions as event-based conversions, based on the following trick.

Here’s how.

Step 1

On all pages where you want to track the event (i.e. clicks on  Download Now button) add the following JavaScript code to the <head> section of the page.

<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>

 

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>

Step 3

Create a HTML file called tracking.html and save it at the location specified at the source of the iframe (Step 1) (src=”tracking.html). Paste your AdWords conversion tracking code in this file. The HTML file will contain the AdWords tracking code only, 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 implemented correctly the script will open an invisible iframe that contains the AdWords conversion tracking code at 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 showing up in the 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.22_1171]
Rating: 8.3/10 (14 votes cast)
VN:F [1.9.22_1171]
Rating: +5 (from 5 votes)
How to Track Clicks as Conversions in Adwords, 8.3 out of 10 based on 14 ratings

About 

Traian is Founder and Director of Search Marketing at Pitstop Media Inc. He has more than 11 years experience in helping small and medium businesses generate and convert organic traffic from search engines. Connect with Traian on Google+

 

47 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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    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.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  25. Danny Gavin said:

    May 17, 12 at 5:22 pm

    Traia – this article is from a lil’ while ago – I wanted to know if it still works in 2012???

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  26. TraiaN said:

    May 17, 12 at 5:28 pm

    it should. additionally you can do it with Google Analytics – http://www.pitstopmedia.com/sem/how-to-track-clicks-as-conversions-in-adwords-using-google-analytics

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  27. 3 Ways To Track Clicks as Conversions in Adwords | | OptidgeOptidge said:

    May 17, 12 at 5:39 pm

    […] 1. How to Track Clicks as Conversions in Adwords […]

  28. Gerdi said:

    Aug 05, 12 at 5:48 am

    What do you think about this solution for tracking downloads as adwords conversions:

    http://blog.gandke.de/Adwords+ConversionTracking+Bei+DownloadLinks+Einsetzen.aspx

    It doesn´t use iframes. Do you think this solution is better?

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  29. Saidul Hassan said:

    Sep 24, 12 at 5:03 am

    Traian, I just also asked on Tomatoa’s GA method. I get lots of clicks from both organic and paid search. I need to know how many download clicks are from adwords. Can you suggest me which one better addresses my case?

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  30. Traian Neacsu said:

    Sep 24, 12 at 9:52 am

    Saidul, this method tracks AdWords conversions only. These conversions will be reported in your AdWords interface.

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  31. John said:

    Nov 21, 12 at 11:20 am

    Great article, but does this still work. Im having trouble and cant see the conversion data. On page security level for adwordscode i guess this is normally http?

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  32. Traian Neacsu said:

    Nov 21, 12 at 4:57 pm

    John, last time I checked with my PPC colleagues, they said it’s still working. If you copied and pasted from the article you might get the curly quotes issue, so you may want to replace them with straight ones, in Notepad.

    Regarding the http VS https, if your conversion happens on a secure page, I think the html has to go into the https directory of the site.

    If you want to test the script you can remove the display style none and see if the iframe is getting triggered.

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  33. John said:

    Nov 22, 12 at 10:19 am

    Hi Traian,

    Thanks for the reply. I am trying to get this to work for an email (Mailto) link. I removed the display:none from the code, so all I have this:

    I also double checked and all the quotes ” from your blog post, they were retyped in notepad then imported into dreamweaver. But when I click on the mailto link it does not seem to open any page or record the conversion?

    here is the code I have used:

    In the head section:

    function setIframe() {var pitstopmedia = document.getElementById(‘psm’).innerHTML = ”;}

    In the email link section (I have replaced the actual email address for spam reasons):

    a href=”mailto:example@example.com?subject=Test” rel=”nofollow”>example@example.scom

    Then created a file called tracking.html, with only the adwords conversion code from the account. saved this to the root directory of the site.

    It just doesn’t seem to work. Appreciate your help on this one. Pages are all HTML

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  34. Traian Neacsu said:

    Nov 22, 12 at 10:59 am

    John,

    I don’t see the onclick event added to the A tag. Or maybe WordPress removed it from your comments

    Your link should look like (I removed the “less than” sign in front of A so it won’t get parsed by WP)
    a href=”mailto:example@example.com?subject=Test” onclick=”setTimeout(setIframe,2000);>example@example.com

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  35. John said:

    Nov 27, 12 at 7:17 am

    Hi Traian,

    Thank you for all your help. it appears I was just being impatient, all working now. just had to wait 24 hours to see stats.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  36. Traian Neacsu said:

    Nov 27, 12 at 11:07 am

    Great! Let me know how it goes.

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  37. Sarah Frantz said:

    Dec 05, 12 at 7:16 am

    I’m having issues getting this to work. I’ve tried a few different things, but both seem to not be working.

    I’m implementing this in Joomla, but I want to verify that my code is correct, as I’ve tried and it still wont track… here’s my script / html http://jsfiddle.net/A5GSr/ .. any suggestions as to why this isn’t tracking??

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  38. Traian Neacsu said:

    Dec 05, 12 at 11:45 am

    Hi Sarah. The code seems ok (though I am not a programmer). Did you wait 24 hours for the data to be reported in Google Adwords?

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  39. Sarah Frantz said:

    Dec 10, 12 at 9:07 am

    Yes, we did wait. I’m not sure what we are doing wrong… We tried multiple times throughout the course of last week to accomplish this via your suggested script.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  40. Traian Neacsu said:

    Dec 10, 12 at 10:52 am

    Sarah, the code works fine on other sites, so you must do a bit of detective work to identify the issue. It can be that the script interferes with another JS.

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  41. Catalin S. said:

    Jan 28, 13 at 2:42 am

    Thank you, Traian ! Your solution is among the few of this kind on the web. Works perfectly too.

    Catalin from Romania.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  42. Traian Neacsu said:

    Jan 28, 13 at 10:55 am

    you’re welcome, Catalin.

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  43. Sarah said:

    Feb 12, 13 at 11:04 am

    Hi Traian.

    Thanks a lot for posting this code. It’s exactly what I want.

    If there are multiple links would each link need right after it or could I just put one at the bottom of the post?

    Thanks for all your help!

    Sarah

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  44. Traian Neacsu said:

    Feb 12, 13 at 11:12 am

    if there are multiple links you need to track, then the code needs to be attached to each link.

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  45. Sarah said:

    Feb 12, 13 at 4:53 pm

    Thanks Traian. Sorry I should have been more explicit. I meant this code after the links.

    Even with multiple links wouldn’t it only need to appear on the page once and wherever it is it would hold the iframe?

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  46. Traian Neacsu said:

    Feb 13, 13 at 11:28 am

    WP does not allow HTML markup to be displayed in the comments – I think the code you referred to was removed. Every piece of code that has a onClick event should be attached to each element that needs to be tracked.

    VN:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  47. Saidul Hassan said:

    Mar 22, 13 at 11:35 pm

    Well, I wasn’t explicit on my earlier query but anybody who is in my shoe might find this Analytics Help article helpful:
    “Comparing Analytics and AdWords conversion metrics”
    http://goo.gl/Ovt1U

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)