Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Google conversion tracking after submit button WordPress

  • SOLVED

Hello. This is my site: www.argentinepassions.com
As you can see, at the end of the site there is a calendar with a form for booking. I have set an adwords campaign and would like to track as a conversion every time someone clicks "Book now" in the form. The problem is that the plugin doesn't send you to another page when you click this button, so I need it to track the conversion when the button is pressed.

Perhaps this helps, but I don't know how to apply it, I need step by step explanation for my specific site:

http://stackoverflow.com/questions/27149647/how-to-implement-a-google-adwords-conversion-pixel-using-ajax-on-a-submit-butt/27149886?noredirect=1#comment42795611_27149886

Thanks

Answers (3)

2015-04-23

Jayaram Y answers:

Hi,

You can use this plugin to track clicking on elements of the page such as contact button, play button etc..

https://wordpress.org/plugins/wp-google-analytics-events/


matiasi comments:

Hello, it's interesting but I don't know how to configure it. How do I know the element name and the other fields required? https://wpflow.com/basic-configuration/

Thanks


Jayaram Y comments:

Hi. You can check the video tutorial. From 1:00.

Element name is the class or ID of that button or anchor link.


Jayaram Y comments:

Mariasi,

Did you mange to do it.? Was that helpful for you


matiasi comments:

Hello, I need the exact information I have to input in each field. I don't know how to find the the class or id of that button. Thanks

2015-04-23

Romel Apuya answers:

Hi,

You can try something like this in ur themes functions.php
but if you can make it to add an id to the button then replace
#banner_396588937 .button.large.primary
with #<strong>buttons_id</strong>


<?php
add_action('wp_head','add_google_trackConversion');
function add_google_trackConversion(){
?>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion_async.js" charset="utf-8"></script>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type='text/javascript'>
/* <![CDATA[ */
jQuery.noConflict();
jQuery( document ).ready(function( $ ) {
$('#banner_396588937 .button.large.primary').click(function(){
window.google_trackConversion({
google_conversion_id: 1234,
google_remarketing_only: true,
});
})
});
/* ]]> */
</script>
<?php
}
?>


Romel Apuya comments:

ohh sorry it should be
since the conversion takes place when the form is submitted.

<?php
add_action('wp_head','add_google_trackConversion');
function add_google_trackConversion(){
?>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion_async.js" charset="utf-8"></script>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type='text/javascript'>
/* <![CDATA[ */
jQuery.noConflict();
jQuery( document ).ready(function( $ ) {
$('#DOPBookingSystem_Form1')on('submit',function(){
window.google_trackConversion({
google_conversion_id: 1234,
google_remarketing_only: true,
});
})
});
/* ]]> */
</script>
<?php
}
?>


Romel Apuya comments:

<?php
add_action('wp_head','add_google_trackConversion');
function add_google_trackConversion(){
?>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion_async.js" charset="utf-8"></script>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type='text/javascript'>
/* <![CDATA[ */
jQuery.noConflict();
jQuery( document ).ready(function( $ ) {
$('#DOPBookingSystem_Form1').on('submit',function(){
window.google_trackConversion({
google_conversion_id: 1234,
google_remarketing_only: true,
});
})
});
/* ]]> */
</script>
<?php
}
?>


matiasi comments:

Hello. Where should I add the tracking code that google provides? Thanks


Romel Apuya comments:

on this part i think


google_conversion_id: 1234,

google_remarketing_only: true,


Hello. Where should I add the tracking code that google provides? Thanks

-- I dont quite understand to be honest..


Romel Apuya comments:

all this code is in the functions.php

2015-04-23

Monit Jadhav answers:

Site doesnt show up for me please advice?


Monit Jadhav comments:



Put this in your functions file

This should do it.


<?php

wp_register_script('google_conversion_js','http://www.googleadservices.com/pagead/conversion_async.js', array(), '1', false);

wp_enqueue_script( 'google_conversion_js');

add_action('wp_footer','add_button_track');

function add_button_track(){
?>
<script type='text/javascript'>

/* <![CDATA[ */

jQuery.noConflict();

jQuery( document ).ready(function( $ ) {

$('#DOPBookingSystem_Submit1').click(function(){

window.google_trackConversion({

google_conversion_id: Your_Conversion_ID,

google_remarketing_only: true,

});

})

});

/* ]]> */

</script>

<?php
}
?>