Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Setting up Google Analytics Event


cclayton

Recommended Posts

Posted

On the product_info page, I want to set up a Google Analytics Event when someone adds an item to the basket. So far I have the link:

 

echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image(tep_output_string('/images/') . 'book_now.png', IMAGE_BUTTON_IN_CART, '139', '41', ' onclick = "checkBeforSubmit();"');

 

And its on this part that I am struggling due to the speach marks:

 

onclick = "checkBeforSubmit();"');

 

I want to add this onto the onclick also:

 

pageTracker._trackEvent("Product_Info", "Book", "$product_name")

 

Any ideas? As because of the speach marks it just keeps getting messed up.

 

Thanks,

 

Chris

Founder & Director at CSC Tours Ltd

Posted

echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image(tep_output_string('/images/') . 'book_now.png', IMAGE_BUTTON_IN_CART, '139', '41', ' onclick = "checkBeforSubmit();"');

 

And its on this part that I am struggling due to the speach marks:

 

onclick = "checkBeforSubmit();"');

 

I want to add this onto the onclick also:

 

pageTracker._trackEvent("Product_Info", "Book", "$product_name")

echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image(tep_output_string('/images/') . 'book_now.png', IMAGE_BUTTON_IN_CART, '139', '41', ' onclick = "checkBeforSubmit(); pageTracker._trackEvent(\'Product_Info\', \'Book\', \'urlencode($product_name)\');"');

 

Something like this should work.

Posted

Chris,

 

because the product_info.php is created dynamically depending on product, the google page clicks will not actually trap the specific product, so adding it to the page is redundant.

 

Chris

Posted

Chris,

 

because the product_info.php is created dynamically depending on product, the google page clicks will not actually trap the specific product, so adding it to the page is redundant.

 

Chris

 

So I see... I have tried and cant get the ($product_name) to show the product name in it... does anyone know a way round this?? There must be a way.

 

Thanks, Chris

Founder & Director at CSC Tours Ltd

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...