Push Function for Asynchronous Tracking
    • 1 Minute to read
    • Dark
      Light

    Push Function for Asynchronous Tracking

    • Dark
      Light

    Article summary

    Always use the push functionality when calling the Smart Pixel, because the script is loaded asynchronously to avoid performance issues.

    /**
     * @param {function(wtSmart)} fn
     */
    wtSmart.push(fn);

    Example

    window.wtSmart = window.wtSmart || [];
    window.wtSmart.push(function(wtSmart) {
        // set initial tracking config
        wtSmart.init.set({
            trackId: '111111111111111',
            trackDomain: 'q3.webtrekk.net'
        });
        
        // set page data
        wtSmart.page.data.set('en.index.home');
        
        // send tracking data and remove data after request
        wtSmart.track();
    });


    Was this article helpful?