Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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.
    #488513

    Hey 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,
    Ismael

    #488677

    I think I doing some similar things. It works normally for button. But it doesn’t work on tab for desktop only.

    #494458

    Hey!

    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,
    Josue

    #505282

    I still having the problem. But the workaround is working, so this thread can be closed. Thanks.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Tab Event’ is closed to new replies.