We’re with you. JoomShaper is offering a 20% Discount on all plans due to the impact of COVID-19.

Support Offline : Mon - Fri / 10am - 6pm (GMT +6)

Your Time: Our Time:

Add JavaScript to the button. To track "click button" event (for Google and Yandex analytics).

Featured Lock Resolved Task
Hi!
I have a button. (id="btn-1521922268430";)
https://snag.gy/JiZlvU.jpg

I neen to add the JavaScript to track "click button" event (for Google and Yandex analytics).
I need to add for "btn-1521922268430" the following code: onclick="yaCounter37719736.reachGoal('btn333'); return true;"

How and where can I do this? If possible, please provide an example!
It would be nice to be able to add additional functions directly to the button fields in the SPPB.

3 Answers

Pavel

More than a month ago #Permalink
Paste this code before </ body>. And do not forget to wrap it with the script tags:

window.addEventListener('load', function(){
document.getElementById('YOUR_BTN_ID').setAttribute("onclick", "yaCounterYOUR_COUNTER_NUMBER.reachGoal('YOUR_TARGET_ID'); return true;");
});

http://dl3.joxi.net/drive/2018/04/29/0008/0401/545169/69/fd4de975f0.png

kupala

More than a month ago #Permalink
Thanks Pavel, I will try!

KirillKozin

More than a month ago #Permalink
Thanks Pavel, it works!:D


There are no replies made for this post yet.
Be one of the first to reply to this post!

126

Templates

333510

Community Users

Newsletter

Don’t miss any updates of our new templates and extensions and all the astonishing offers we bring for you.
We never spam

Joomla! ® name is used under a limited license from Open Source Matters in the United States and other countries. JoomShaper.com is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.

Connect Us