track
    • 1 Minute to read
    • Dark
      Light

    track

    • Dark
      Light

    Article summary

    The track method sends the collected data to our track servers. After sending, the pixel automatically deletes all data from the cache and cannot access it anymore.

    If you want to keep the data accessible, set "true" as the first argument. This might be especially relevant for tracking single page applications. When keeping data, you need to remove the data you do not need anymore manually.

    /**
     * @param {boolean=false} [keepData]
     */
    wtSmart.track(keepData);

    With the method trackPage and trackAction you can force a page or event request.

    /**
     * @param {boolean=false} [keepData]
     */
    wtSmart.trackPage(keepData);
    /**
     * @param {boolean=false} [keepData]
     */
    wtSmart.trackAction(keepData);

    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 the request
    	wtSmart.track();
    
    	// send tracking data and keep data
    	wtSmart.track(true);
    });

    Code Generator

    Use the code generator to create individual code that you can then integrate directly into the website.


    Was this article helpful?

    What's Next