Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Tracking tab events in jquery-ui

I currently have tabs() working on a page with 4 tabs.

I am trying to use event tracking to track tab clicks which works fine EXCEPT on initial page load. I want the page to identify which tab is loaded on page load but it is not registering

My Code:

    $( "#tabs" ).tabs({ 
        //activate to pass the active tab on click to the hidden field
        activate: function( event, ui ) {
            $('#activeTab').val($("#tabs").tabs('option', 'active'));
            trackEvent('DeptPerformance', 'Tabs', $("#tabs .ui-tabs-active").text());
        },
        disabled: [<?=($isGroup?0:'')?>],
        active: <?=($isGroup?1:0)?>
    });

I tried adding:

        create: function( event, ui ) {
            trackEvent('DeptPerformance', 'Tabs', $("#tabs .ui-tabs-active").text());
        },

But this does not track the event.

Is there another method or event I should be using to track the event once the page is loaded?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Further testing identified that the analytics code was not loaded when the tab is created - added a timeout to wait 1 second for analytics to catch up.

to fix:

    $( "#tabs" ).tabs({ 
        //activate to pass the active tab on click to the hidden field
        activate: function( event, ui ) {
            $('#activeTab').val($("#tabs").tabs('option', 'active'));
            trackEvent('DeptPerformance', 'Tabs', $("#tabs .ui-tabs-active").text());
        },
        create: function( event, ui ) {
            setTimeout(function(){
                 trackEvent('DeptPerformance', 'Tabs', $("#tabs .ui-tabs-active").text());
            }, 1000);
        },
        disabled: [<?=($isGroup?0:'')?>],
        active: <?=($isGroup?1:0)?>
    });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!