Title: Uncaught TypeError: nab.trigger is not a function
Last modified: December 27, 2023

---

# Uncaught TypeError: nab.trigger is not a function

 *  Resolved [mythily](https://wordpress.org/support/users/mythily/)
 * (@mythily)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/uncaught-typeerror-nab-trigger-is-not-a-function/)
 * Hi
 * after adding the below js code for one page, and started testing It is not working
   and getting the below error
 * **Error: ** Uncaught TypeError: nab.trigger is not a function
 * **JS Code: **
 *     ```wp-block-code
       <script type="text/javascript">
       setTimeout( function() {
         nab.trigger( 'time-10s' );
       }, 10000 );
       setTimeout( function() {
         nab.trigger( 'time-30s' );
       }, 30000 );
       setTimeout( function() {
         nab.trigger( 'time-60s' );
       }, 60000 );
       setTimeout( function() {
         nab.trigger( 'time-90s' );
       }, 90000 );
       ( function() {
         [ 30, 50, 75, 100 ].forEach(
           ( threshold ) => document.addEventListener( 'scroll', () => {
             const bottom = window.pageYOffset + window.innerHeight;
             const scroll = 100 * bottom / document.body.clientHeight;
             if ( scroll >= threshold ) {
               nab.trigger( scroll-${ threshold } );
             }
           } )
         );
       } )();
       </script>
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [David Aguilera](https://wordpress.org/support/users/davilera/)
 * (@davilera)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/uncaught-typeerror-nab-trigger-is-not-a-function/#post-17304950)
 * You have to make sure that our tracking script is properly loaded on your site.
   For example, if you’re using a cache plugin, purge your cache after starting 
   a test.
 * Also, exclude our tracking script from being optimized, combined, deferred, etc—
   you want to make sure it’s loaded as soon as possible without any “speed optimizations.”
 * Finally, when using a global function such as `nab.trigger`, it’s usually a good
   idea to wrap the call in an `if` statement and check if it’s available. Something
   like this:
 *     ```wp-block-code
       <script type="text/javascript">
       (function() {
         if ( ! nab.trigger ) return;
   
         setTimeout( function() {
           nab.trigger( 'time-10s' );
         }, 10000 );
         // ...
       })()
       </script>
       ```
   
 * If none of this works, please let me know the URL of your site and I’ll look 
   into it.

Viewing 1 replies (of 1 total)

The topic ‘Uncaught TypeError: nab.trigger is not a function’ is closed to new replies.

 * ![](https://ps.w.org/nelio-ab-testing/assets/icon-256x256.png?rev=2514600)
 * [Nelio A/B Testing – AB Tests and Heatmaps for Better Conversion Optimization](https://wordpress.org/plugins/nelio-ab-testing/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nelio-ab-testing/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nelio-ab-testing/)
 * [Active Topics](https://wordpress.org/support/plugin/nelio-ab-testing/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nelio-ab-testing/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nelio-ab-testing/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [David Aguilera](https://wordpress.org/support/users/davilera/)
 * Last activity: [2 years, 5 months ago](https://wordpress.org/support/topic/uncaught-typeerror-nab-trigger-is-not-a-function/#post-17304950)
 * Status: resolved