-
AuthorPosts
-
August 15, 2015 at 5:19 pm #488250
I am trying to add tab event. I added the following javascript:
jQuery(document).ready(function() {
jQuery(‘.tab’).on(‘click’, function(){
var tab_title = jQuery(this).html();
if (tab_title.indexOf(“FRIDAY”) >= 0){
ga(‘send’, ‘pageview’, ‘/schedule/friday’);
console.log(‘GA 1’);
}});
});It works on mobile. But the event didn’t fire on desktop.
And if I want to add some custom code to the tab element, I think I should modify the tabs.php in the avia-shortcodes folder. But how can I do this in child theme? If I just copy the tabs.php into child theme, the script doesn’t seems loaded.
- This topic was modified 9 years, 3 months ago by boscotwcheung.
August 17, 2015 at 4:26 am #488513Hey boscotwcheung!
Thank you for using Enfold.
Can you please provide a link to a test page? You can add the script in the functions.php file, almost the same as the solution provided here https://kriesi.at/support/topic/please-clear-this-up-for-em-ga-tracking-2/#post-348525
Best regards,
IsmaelAugust 17, 2015 at 8:39 am #488677I think I doing some similar things. It works normally for button. But it doesn’t work on tab for desktop only.
August 27, 2015 at 9:36 pm #494458Hey!
Something to keep in mind is that tab titles in mobile and desktop are actually distinct (in the markup). Also, i noted you are using another script to catch the tab click event::
function tab_clicked(ele){ var tab_title = jQuery(ele).html(); if (tab_title.indexOf("FRIDAY") >= 0){ ga('send', 'pageview', '/schedule/friday'); mixpanel.track('Schedule Tab Opened', {'Tab Name':'Friday'}); } if (tab_title.indexOf("SATURDAY") >= 0){ ga('send', 'pageview', '/schedule/saturday'); mixpanel.track('Schedule Tab Opened', {'Tab Name':'Saturday'}); } if (tab_title.indexOf("ON DEMAND") >= 0){ ga('send', 'pageview', '/schedule/ondemand'); mixpanel.track('Schedule Tab Opened', {'Tab Name':'On Demand'}); } }
Regarding using a modified ALB element from a child theme, refer to the following:
http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/Best regards,
JosueSeptember 18, 2015 at 8:11 am #505282I still having the problem. But the workaround is working, so this thread can be closed. Thanks.
-
AuthorPosts
- The topic ‘Tab Event’ is closed to new replies.