简体   繁体   中英

Track clicks on website as conversions

Below is the code of the button that marked in red

<div class="ccms_form_element cfdiv_submit" id="input_submit_51_container_div" style="text-align:left">
    <input name="input_submit_5" class="" value="Send" type="submit" />
    <div class="clear"></div>
    <div id="error-message-input_submit_5"></div>
</div>

I just check the google support of "Track clicks on your website as conversions" but I don't know which code should I use and how to modify.

Google: Add the code to a text link: In the code below, replace “ http://example.com/your-link ” with the URL for your website or telephone link, and replace “Download now!” with your link text.

<a onclick="goog_report_conversion ('http://example.com/your-link')"
   href="http://example.com/your-link">Download now!</a>

Or:

<a onclick="goog_report_conversion ('tel:800-123-4567')"
   href="#">Call now!</a>

Add the code to a button: In the code below, replace “ http://example.com/your-link ” with the URL for your website or telephone link, and replace “Download now!” with your button text.

<button onclick="goog_report_conversion('http://example.com/your-link')" 
        href="http://example.com/your-link">Download now!</button>

Or:

<button onclick="goog_report_conversion('tel:800-123-4567')">Call 800-123-4567</button>

Add the code to an image: In the code below, replace “download_button.gif” with your button image, replace the width and height with your button's parameters, and replace “ http://example.com/your-link ” with the URL for your link.

<img src="download_button.gif" alt="Download Whitepaper"
        width="32" height="32"
        onClick="goog_report_conversion
        ('http://example.com/your-link')"/>

Or:

<img src="my_phone_button.gif" alt="Call: 800-123-4567"
     width="32" height="32" 
     onClick="goog_report_conversion('tel:800-123-4567')"/>

You can add "onclick" events to input fields like this as well ( https://www.w3schools.com/jsref/event_onclick.asp )

 <div class="ccms_form_element cfdiv_submit" id="input_submit_51_container_div" style="text-align:left"> <input name="input_submit_5" class="" value="Send" type="submit" onclick="console.log('track something');" /> <div class="clear"></div> <div id="error-message-input_submit_5"></div> </div> 

So something like

<input name="input_submit_5" class="" value="Send" type="submit" onclick="goog_report_conversion ('http://example.com/your-link')" />

should work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM