Jump to content

Track Add to cart button in GA


dorje

Recommended Posts

Hi all

Does anybody know anyway to track the ajax add to cart button in google analytics ? I googled on this thing and spent hours without getting any solutions on this.

But i found some solutions for other ecommerce platform but unluckily i coudn't get the solution for prestashop.

But i did tried as by other solutions but no gain.

 

SO just want to know is there anyone who can do this ?

  • Like 1
Link to comment
Share on other sites

it's easy to achieve

in this case you have to edit javascript file: modules/blockcart/ajax-cart.js

you've got there:

 

//for every 'add' buttons...
 $('.ajax_add_to_cart_button').unbind('click').click(function(){
  var idProduct =  $(this).attr('rel').replace('nofollow', '').replace('ajax_id_product_', '');
  if ($(this).attr('disabled') != 'disabled')
   ajaxCart.add(idProduct, null, false, this);
  return false;
 });
 //for product page 'add' button...
 $('#add_to_cart input').unbind('click').click(function(){
  ajaxCart.add( $('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null);
  return false;
 });

 

after functions: ajaxCart.add();

 

add this:

 

_gaq.push(['_trackEvent', 'cart', 'Add to cart', 'product added to cart']);

 

 

effect:

 

ipuVPAk.png

  • Like 1
Link to comment
Share on other sites

thanks for this but where in google analytics it will show the products which were added by customers ?

And i guess you are doing this by event tracking feature of google analytics .

So will it show which product was added , it's quantity and price in the report ?

Actually i was looking for similar like lhis http://www.blog.analyticsinspector.com/how-to-track-products-added-to-basket-in-google-analytics/

Link to comment
Share on other sites

And where i should put this in //for product page 'add' button... or for //for every 'add' buttons..

_gaq.push(['_trackEvent', 'cart', 'Add to cart', 'product added to cart']);\

Actually i dont know much about coding

Also do i have to enable event tracking feature or something else in google analytics to make it work or it will automatically work and show the reports in google analytics ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...