Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to disable bulk tracking #109

Merged
merged 1 commit into from Dec 5, 2022
Merged

Add method to disable bulk tracking #109

merged 1 commit into from Dec 5, 2022

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Dec 3, 2022

Adds a method disableBulkTracking.

This can be useful in some cases like below where maybe one method might want to send multiple requests but others only a single and you want to prevent that every method needs to know that bulk tracking is being used. Meaning for simplicity you only want to enable it for one method and then disable it again.

    private $tracker;

    public function trackTest(string $name, string $action)
    {
        $this->tracker->doTrackEvent('Foo', $action, $name, 1);
       // want to avoid needing to call doBulkTrack here and want to avoid bulk tracking enabled in constructor
    }

    public function trackFooBar(string $name, string $action)
    {
        $this->tracker->enableBulkTracking();
        $this->tracker->doTrackEvent('Foo', $action, $name, 1);
        $this->tracker->doTrackEvent('Bar', $action, $name, 1);
        $this->tracker->doTrackEvent('Baz', $action, $name, 1);
        $this->tracker->doBulkTrack();
        $this->tracker->disableBulkTracking();
    }

Review

Adds a method `disableBulkTracking`
@tsteur tsteur added this to the Current sprint milestone Dec 3, 2022
@sgiehl sgiehl merged commit ddd332d into master Dec 5, 2022
@sgiehl sgiehl deleted the disableBulkTracking branch December 5, 2022 11:08
@innocraft-automation innocraft-automation removed this from the Current sprint milestone Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants