How to execute Google Adwords conversion tracking

2020-07-27 20:26发布

问题:

I've got what appears to be a common scenario. I have a page where someone fills out a form and rather than redirecting to a different thank you page all the tracking needs to take place on the same page.

I found this link here that explains a solution which I implemented as per the below after a successful submission (conversion ID is 11111111 and the label is 22222222).

$("#conversion-script").prop('src', '//www.googleadservices.com/pagead/conversion.js');
                $("#ga-code img").prop('src', '//www.googleadservices.com/pagead/conversion/11111111/?value=0&label=22222222&guid=ON&script=0');

When this gets executed I'm monitoring the network tab for developer tools and see that the GoogleAdServices.com address gets called successfully, and not only that but I have Google Tag Assistance (Chrome extension) running and when this event fires it comes up under "Tags Found" and says "working".

When I check the adwords account however, it's not showing up. I've confirmed that the tracking codes are all correct, and the first one was made 7 days ago.

Ideas?

回答1:

For example you have such button:

<a href = '#' class = 'add_to_cart'><img src = 'btn_buy.png'></a>

Try this script:

<SCRIPT src='/js/jquery.js' type=text/javascript></SCRIPT> 
<SCRIPT type=text/javascript> 

$(document).ready(function() 
{ 
  var add_to_cart_processed = false; 

  $('.add_to_cart').click(function() 
  { 
    if (!add_to_cart_processed) 
    { 
      $('body').append('<div id = "remarketing_basket" style = "display:none"></div>'); 
      $('#remarketing_basket').load('/add_basket.txt'); 
    } 
  }); 
}); 
</SCRIPT>

In file add_basket.txt you need to save your conversion code.