- Posts: 77
- Thank you received: 1
how can I add js function in button body?
10 years 1 month ago - 10 years 1 month ago #248434
by Denys
how can I add js function in button body? was created by Denys
-- 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
-- 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: 10 years 1 month ago by Denys.
Please Log in or Create an account to join the conversation.
10 years 1 month ago #248437
by nicolas
Replied by nicolas on topic how can I add js function in button body?
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.'" ';
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.
10 years 1 month ago #248486
by Denys
Replied by Denys on topic how can I add js function in button body?
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.175 seconds