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.

    Value

    Description

    Data Type

    Default Value

    Required

    keepData

    After sending the tracking data, the Smart Pixel automatically removes all defined data. If you want to keep the data, set true as the first argument, then you can delete the data manually.

    Boolean

    false

    -

    import { Component } from '@angular/core';
    import { WebtrekkSmartPixelAngular } from '@webtrekk-smart-pixel/angular';
    
    @Component({
        template: `<div>[ ... ]</div>`
    })
    export class ExampleComponent {
        constructor(private pixel: WebtrekkSmartPixelAngular) {
            this.pixel.track(false);
        }
    }

    If you want to track all current added information, add the directive wt-track to your template.

    Please add WebtrekkSmartPixelModule to your root NgModule and configure the options before using directives.

    import { Component } from '@angular/core';
    
    @Component({
        template: `<div [wt-page-data]="webtrekkData" [wt-track]="1"></div>`
    })
    export class ExampleComponent {
        webtrekkData = {
            name: 'name',
            search: 'search',
            numberSearchResults: 7
        }
    }


    Was this article helpful?

    What's Next