
-
AuthorPosts
-
May 31, 2015 at 9:11 pm #452281
Hi guys,
Searched the forum found a few stuff but no solution so far.
I am trying to install Google Adwords Conversion when someone downloads a .exe file. As mentioned here:
The tracking code itself has been added successfully. (sample below)
<!-- Google Code for Add to Cart Conversion Page In your html page, add the snippet and call goog_report_conversion when someone clicks on the chosen link or button. --> <script type="text/javascript"> /* <![CDATA[ */ goog_snippet_vars = function() { var w = window; w.google_conversion_id = 12345678; w.google_conversion_label = "abcDeFGHIJklmN0PQ"; w.google_conversion_value = 13.00; w.google_conversion_currency = "USD"; w.google_remarketing_only = false; } // DO NOT CHANGE THE CODE BELOW. goog_report_conversion = function(url) { goog_snippet_vars(); window.google_conversion_format = "3"; var opt = new Object(); opt.onload_callback = function() { if (typeof(url) != 'undefined') { window.location = url; } } var conv_handler = window['google_trackConversion']; if (typeof(conv_handler) == 'function') { conv_handler(opt); } } /* ]]> */ </script> <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion_async.js"> </script>
There are two options text link or image:
a text link <body> <!-- Below is a sample link for a file download. You need to replace the URL with the file and the DOWNLOAD NOW text with the text you want to hyperlink. --> <a onclick="goog_report_conversion ('http://www.example.com/whitepapers/a.pdf')" href="#" >DOWNLOAD NOW</a> </body> </html> an image <!-- Below is a sample image for a file download. Replace download_button.gif with your button image and the document URL with your file's URL. --> <body> <img src="download_button.gif" alt="Download Whitepaper" width="32" height="32" onClick="goog_report_conversion ('http://www.mysite.com/whitepapers/a.pdf')"/> </body> </html>
How do I add this to my url? I am using a Icon Box with the Avia Layout Builder and can’t edit the HTML code directly.
Thanks!
June 2, 2015 at 5:09 pm #453218Hey alexander-_-!
Are you trying to add it to an iconbox so it gets run when you click on the icon? Can you send us a link to your page so we can take a closer look?
Cheers!
ElliottJune 2, 2015 at 8:14 pm #453369Yes exactly! Will reply in private.
June 2, 2015 at 8:15 pm #453370This reply has been marked as private.June 3, 2015 at 1:55 am #453475Hi,
Use the following:
function add_custom_script(){ ?> <script> (function($){ $(window).load(function() { $("a[title='XML2PDF Formatting Engine']").attr("onclick", "goog_report_conversion('http://www.mysite.com/whitepapers/a.pdf')""); }); })(jQuery); </script> <?php } add_action('wp_footer', 'add_custom_script');
That will target all links with a title of “XML2PDF Formatting Engine” and apply the onclick property to them. Modify and repeat as needed.
Regards,
JosueJune 3, 2015 at 9:08 pm #454096Thank you, it works!!
-
AuthorPosts
- The topic ‘Google Adwords Conversion onclick’ is closed to new replies.