how can I add js function in button body?

  • Posts: 77
  • Thank you received: 1
8 years 10 months ago #248434

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.5

Hello,

$ajax = 'onclick="var field=document.getElementById(\'hikashop_product_quantity_field_'.$i.'\');'.$ajax.'" ';

In this string i must to add sum js code for google analytics

This code onclick="ga('send','event','zakaz', 'zakazal');"
When i add this code my button is not work(cannot add goods in basket).
This is need for Google Analytics goal to add to the press of a button.
This is need for to track conversions
how can I add js function or this string (onclick="ga('send','event','zakaz', 'zakazal');" ) in button body?
Regards

Last edit: 8 years 10 months ago by Denys.

Please Log in or Create an account to join the conversation.

  • Posts: 84043
  • Thank you received: 13619
  • MODERATOR
8 years 10 months ago #248437

Hi,

You can change the line:
$ajax = 'onclick="var field=document.getElementById(\'hikashop_product_quantity_field_'.$i.'\');'.$ajax.'" ';

to:
$ajax = 'onclick="var field=document.getElementById(\'hikashop_product_quantity_field_'.$i.'\'); _gaq.push();'.$ajax.'" ';

The following user(s) said Thank You: Denys

Please Log in or Create an account to join the conversation.

  • Posts: 77
  • Thank you received: 1
8 years 10 months ago #248486

Thank you, this is what I need :woohoo: :woohoo: :woohoo:

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum
loading