Skip to content

Commit

Permalink
feat(tracker): add new disableCampaignParameters tracker method
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelRoux committed May 28, 2024
1 parent 243fc46 commit 4cfda65
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,8 @@ describe('MatomoTracker', () => {
expectSimpleMethod('enableBrowserFeatureDetection', []),
);

it('should disable campaign parameters', expectSimpleMethod('disableCampaignParameters', []));

it('should ignore calls when disabled', () => {
// Given
const tracker = createTracker({ disabled: true });
Expand Down
11 changes: 11 additions & 0 deletions projects/ngx-matomo-client/core/tracker/matomo-tracker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,17 @@ export abstract class MatomoTracker {
this.push(['enableBrowserFeatureDetection']);
}

/**
* By default, Matomo will send campaign parameters (mtm, utm, etc.) to the tracker and record that information.
* Some privacy regulations may not allow for this information to be collected.
* If this applies to you, call this method to prevent campaign parameters from being sent to the tracker.
*
* <b>This method is available as of Matomo 5.1.</b>
*/
disableCampaignParameters(): void {
this.push(['disableCampaignParameters']);
}

/** Asynchronously call provided method name on matomo tracker instance */
protected get<G extends Getters<MatomoInstance>>(
getter: G,
Expand Down

0 comments on commit 4cfda65

Please sign in to comment.