Comments 3firosyd started the conversationJanuary 30, 2022 at 6:47pmHi there,I added a button elementor in Home in order to tracking it via Google Analytics.Is there a place to insert the javascript code like this?ga('send', { hitType: 'event', eventCategory: 'Button Agenda 2022', eventAction: 'click'})If possible do you know if the elementor button elementor allow "onclick" attribute in order to tracking the clicks in button?Thanks 2,610PenciDesign repliedJanuary 31, 2022 at 2:17amHi,1. You can add this code to Appearance → Customize → Logo & Header → General → Add Custom Code Inside <head> tag.2. Yes. Elementor already support the "onclick" event of the button, please read the document detail here: https://elementor.com/help/button-widget/Regards,PenciDesign.1 Like 3firosyd repliedJanuary 31, 2022 at 12:47pmHi there, I've seen the support page for button elementor - https://elementor.com/help/button-widget/ I think better use it rather than the code previous sent to use it in head as you explained me. Hovewer, the procedures to the button tracking aren't same from another way - via javascript code for Google Analytics as sent previous. Now there is the code for the button:document.addEventListener("DOMContentLoaded", function(event) {jQuery('#My_Button a').click(function(){// tracking code here// for example Facebook Pixel:fbq('track','AddToCart');});}); In this code I need setting the tracking code GA then it's enough to set tracking code GA inside in place of code Facebook Pixel without comment code? There it's said to insert that code above in HTML widget but would be between tag <script></script> isn't it?Thank you so muchRegards 2,610PenciDesign repliedJanuary 31, 2022 at 12:48pmHi,Yes. You need to enter the JS code between the <script>code</script> tags.Regards,PenciDesign.1 Like 3firosyd repliedJanuary 31, 2022 at 1:53pmThanks a lot! Sign in to reply ...
Hi there,
I added a button elementor in Home in order to tracking it via Google Analytics.
Is there a place to insert the javascript code like this?
ga('send', {
hitType: 'event',
eventCategory: 'Button Agenda 2022',
eventAction: 'click'
})
If possible do you know if the elementor button elementor allow "onclick" attribute in order to tracking the clicks in button?
Thanks
Hi,
1. You can add this code to Appearance → Customize → Logo & Header → General → Add Custom Code Inside <head> tag.
2. Yes. Elementor already support the "onclick" event of the button, please read the document detail here: https://elementor.com/help/button-widget/
Regards,
PenciDesign.
Hi there,
I've seen the support page for button elementor - https://elementor.com/help/button-widget/
I think better use it rather than the code previous sent to use it in head as you explained me.
Hovewer, the procedures to the button tracking aren't same from another way - via javascript code for Google Analytics as sent previous.
Now there is the code for the button:
document.addEventListener("DOMContentLoaded", function(event) {
jQuery('#My_Button a').click(function(){
// tracking code here
// for example Facebook Pixel:
fbq('track','AddToCart');
});
});
In this code I need setting the tracking code GA then it's enough to set tracking code GA inside in place of code Facebook Pixel without comment code?
There it's said to insert that code above in HTML widget but would be between tag <script></script> isn't it?
Thank you so much
Regards
Hi,
Yes. You need to enter the JS code between the <script>code</script> tags.
Regards,
PenciDesign.
Thanks a lot!