Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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!

    #453218

    Hey 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!
    Elliott

    #453369

    Yes exactly! Will reply in private.

    #453370
    This reply has been marked as private.
    #453475

    Hi,

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

    #454096

    Thank you, it works!!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Google Adwords Conversion onclick’ is closed to new replies.