{"id":21184258,"url":"https://github.com/PiwikPRO/ngx-piwik-pro","last_synced_at":"2025-07-10T00:33:19.285Z","repository":{"id":43469629,"uuid":"464430505","full_name":"PiwikPRO/ngx-piwik-pro","owner":"PiwikPRO","description":"Dedicated Piwik PRO library that helps with implementing Piwik PRO Tag Manager and the Piwik PRO tracking client in Angular 8+ applications.","archived":false,"fork":false,"pushed_at":"2024-04-02T15:24:22.000Z","size":751,"stargazers_count":2,"open_issues_count":11,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-14T04:19:26.265Z","etag":null,"topics":["team-integrations"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PiwikPRO.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-28T10:09:20.000Z","updated_at":"2024-05-28T22:19:02.398Z","dependencies_parsed_at":"2023-01-28T10:45:27.261Z","dependency_job_id":"c571ad69-bcac-46e0-91e7-244ad6c37324","html_url":"https://github.com/PiwikPRO/ngx-piwik-pro","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":"0.033333333333333326","last_synced_commit":"8acdbfd5128aca5d950dc7a6b178f0c127e20a57"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiwikPRO%2Fngx-piwik-pro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiwikPRO%2Fngx-piwik-pro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiwikPRO%2Fngx-piwik-pro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiwikPRO%2Fngx-piwik-pro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PiwikPRO","download_url":"https://codeload.github.com/PiwikPRO/ngx-piwik-pro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225606572,"owners_count":17495551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["team-integrations"],"created_at":"2024-11-20T18:01:13.509Z","updated_at":"2025-07-10T00:33:19.250Z","avatar_url":"https://github.com/PiwikPRO.png","language":"TypeScript","funding_links":[],"categories":["Development Utilities"],"sub_categories":["Analytics"],"readme":"\n\u003ca name=\"readmemd\"\u003e\u003c/a\u003e\n\n\n\n\n# Piwik PRO Library for Angular\n\nDedicated Piwik PRO library that helps with implementing Piwik PRO Tag Manager and the Piwik PRO tracking client in Angular 8+ applications.\n\n- [Installation](#installation)\n  - [NPM](#npm)\n  - [Basic setup](#basic-setup)\n  - [Routing setup](#set-up-the-routing-module)\n  - [Advanced routing setup](#advanced-setup-for-the-routing-module)\n- [Piwik PRO Services](#piwik-pro-services)\n  - [Custom Events](#send-custom-events)\n  - [Page Views](#send-page-views-and-virtual-page-views)\n\n### Installation\n\n#### NPM\n\nTo use this package in your project, run the following command.\n\n```\nnpm install @piwikpro/ngx-piwik-pro\n```\n\n#### Basic setup\n\nIn your Angular Project, include the `NgxPiwikProModule` in the highest level application module. ie `AddModule`.\nTo set up the Piwik PRO Tag Manager container in the app, the easiest way is to call the `forRoot()` method.\nIn the arguments, pass your app ID and your account URL as parameters (marked 'container-id' and 'container-url' in the example below).\n\n```ts\nimport { NgxPiwikProModule } from \"@piwikpro/ngx-piwik-pro\";\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [\n    BrowserModule,\n    NgxPiwikProModule.forRoot(\"container-id\", \"container-url\"),\n    // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  ],\n  providers: [],\n  bootstrap: [AppComponent],\n})\nexport class AppModule {}\n```\n\n#### Setup with nonce\n\nThe nonce attribute is useful to allow-list specific elements, such as a particular inline script or style elements. It can help you to avoid using the CSP unsafe-inline directive, which would allow-list all inline scripts or styles.\n\nIf you want your nonce to be passed to the script, pass it as the third argument when calling the script initialization method.\n\n```ts\nimport { NgxPiwikProModule } from \"@piwikpro/ngx-piwik-pro\";\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [\n    BrowserModule,\n    NgxPiwikProModule.forRoot(\"container-id\", \"container-url\", {nonce: \"nonce-hash\"}),\n    // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  ],\n  providers: [],\n  bootstrap: [AppComponent],\n})\nexport class AppModule {}\n```\n\n#### Set up the Routing Module\n\nWe provide a second Module Dependency to configure Router Event Bindings and perform automatic page views every time your application navigates to another page.\n\nAdd `NgxPiwikProRouterModule` on AppModule to enable auto track `Router` events.\n\n**IMPORTANT:** This Module subscribes to Router events when the bootstrap component is created, and then cleans up any subscriptions related to previous component when it is destroyed. You may get some issues if using this module with server side rendering or multiple bootstrap components. If that's the case, we recommend subscribing to the page view events manually.\n\n```ts\nimport { NgxPiwikProModule, NgxPiwikProRouterModule } from '@piwikpro/ngx-piwik-pro';\n...\n\n@NgModule({\n  ...\n  imports: [\n    ...\n    NgxPiwikProModule.forRoot('container-id'),\n    NgxPiwikProRouterModule\n//  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  ]\n})\nexport class AppModule {}\n```\n\n#### Advanced setup for the Routing Module\n\n##### You can customize some rules to include/exclude routes on `NgxPiwikProRouterModule`. The include/exclude settings allow:\n\n- Simple route matching: `{ include: [ '/full-uri-match' ] }`;\n- Wildcard route matching: `{ include: [ '*/public/*' ] }`;\n- Regular Expression route matching: `{ include: [ /^\\/public\\/.*/ ] }`;\n\n```ts\nimport { NgxPiwikProModule, NgxPiwikProRouterModule } from '@piwikpro/ngx-piwik-pro';\n...\n\n@NgModule({\n  ...\n  imports: [\n    ...\n    NgxPiwikProModule.forRoot('container-id'),\n    NgxPiwikProRouterModule.forRoot({ include: [...], exclude: [...] })\n//  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  ]\n})\nexport class AppModule {}\n```\n\n##### Track of PageViews from the first visit to the site.\n\nThe default 'Data Collection' settings assume that the 'Track page views in a single-page application' option is set to true. You will find an iformation that if this option is enabled, we will record every change in the state of the browser history on the page and report it as a page view in the reports. You need to know that this option should be disabled if you want to use the ngx-piwik-pro library.\n\nThis setting can be found in:\n`Administration -\u003e Sites \u0026 Apps -\u003e (choose your site or apps ) -\u003e Data Collection -\u003e Track page views in a single-page application`\n\nIn order to work according to the default Data Collection settings, the library skips the first PageViews so as not to cause duplicate entries. However, if you have taken care to disable the above settings, you should also pass the following settings to the library.\n\n```ts\nimport { NgxPiwikProModule, NgxPiwikProRouterModule } from '@piwikpro/ngx-piwik-pro';\n...\n\n@NgModule({\n  ...\n  imports: [\n    ...\n    NgxPiwikProModule.forRoot('container-id'),\n    NgxPiwikProRouterModule.forRoot({ skipFirstPageView: false })\n//  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  ]\n})\nexport class AppModule {}\n```\n\n##### Customize Data Layer name\n\n```ts\n@Component(...)\nimport { NgxPiwikProModule, NgxPiwikProRouterModule } from '@piwikpro/ngx-piwik-pro';\n...\n\n@NgModule({\n  ...\n  imports: [\n    ...\n    NgxPiwikProModule.forRoot('container-id', 'container-url', {dataLayerName: \"myDataLayerName\"}),\n//  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  ]\n})\nexport class AppModule {}\n```\n\n### Piwik PRO Services\n\n#### Send Custom Events\n\n```ts\n@Component( ... )\nexport class TestFormComponent {\n\n  constructor(\n    private customEventsService: CustomEventsService\n  ) {}\n\n  onUserInputName() {\n    ...\n    this.customEventsService.trackEvent('user_register_form', 'enter_name', 'Name', 'Value');\n  }\n\n  onUserInputEmail() {\n    ...\n    this.customEventsService.trackEvent('user_register_form', 'enter_email', 'Email', 'Value');\n  }\n\n  onSubmit() {\n    ...\n    this.customEventsService.trackEvent('user_register_form', 'submit', 'Sent');\n  }\n}\n\n```\n\n#### Send page views and virtual page views\n\n```ts\n@Component(...)\nexport class TestPageComponent implements OnInit {\n\n  constructor(\n    protected pageViewsService: PageViewsService\n  ) {}\n\n  ngOnInit() {\n    this.pageViewsService.trackPageView('Title')\n  }\n\n}\n```\n\n#### Send an event with Data Layer\n\n```ts\n@Component(...)\nexport class TestPageComponent implements OnInit {\n\n  constructor(\n    protected dataLayerService: DataLayerService\n  ) {}\n\n  ngOnInit() {\n    this.dataLayerService.push({ event: 'test-event' })\n  }\n\n}\n```\n\n\n\u003ca name=\"globalsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n### Namespaces\n\n- [ClientConfiguration](#namespacesclientconfigurationreadmemd)\n- [ContentTracking](#namespacescontenttrackingreadmemd)\n- [CookieManagement](#namespacescookiemanagementreadmemd)\n- [CrossDomainTracking](#namespacescrossdomaintrackingreadmemd)\n- [CustomDimensions](#namespacescustomdimensionsreadmemd)\n- [CustomEvent](#namespacescustomeventreadmemd)\n- [DataLayer](#namespacesdatalayerreadmemd)\n- [DownloadAndOutlink](#namespacesdownloadandoutlinkreadmemd)\n- [eCommerce](#namespacesecommercereadmemd)\n- [ErrorTracking](#namespaceserrortrackingreadmemd)\n- [GoalConversions](#namespacesgoalconversionsreadmemd)\n- [Heartbeat](#namespacesheartbeatreadmemd)\n- [Miscellaneous](#namespacesmiscellaneousreadmemd)\n- [PageViews](#namespacespageviewsreadmemd)\n- [SiteSearch](#namespacessitesearchreadmemd)\n- [UserManagement](#namespacesusermanagementreadmemd)\n\n### Type Aliases\n\n- [Dimensions](#type-aliasesdimensionsmd)\n- [EcommerceOptions](#type-aliasesecommerceoptionsmd)\n- [Initialize](#type-aliasesinitializemd)\n- [InitOptions](#type-aliasesinitoptionsmd)\n- [PaymentInformation](#type-aliasespaymentinformationmd)\n- [Product](#type-aliasesproductmd)\n- [VisitorInfo](#type-aliasesvisitorinfomd)\n\n### Variables\n\n- [default](#variablesdefaultmd)\n\n\n\u003ca name=\"namespacesclientconfigurationreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ClientConfiguration\n\n\n\n- [getDomains](#namespacesclientconfigurationfunctionsgetdomainsmd)\n- [setDomains](#namespacesclientconfigurationfunctionssetdomainsmd)\n\n\n\u003ca name=\"namespacesclientconfigurationfunctionsgetdomainsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getDomains()\n\n\u003e **getDomains**(): `Promise`\\\u003c`string`[]\\\u003e\n\nReturns list of internal domains (set with \"setDomains\" function and used in outlink tracking).\n\n### Returns\n\n`Promise`\\\u003c`string`[]\\\u003e\n\n\n\u003ca name=\"namespacesclientconfigurationfunctionssetdomainsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setDomains()\n\n\u003e **setDomains**(`domains`): `void`\n\nAllows to define a list of internal domains or mobile app URIs. Used in outlink tracking for determining whether a link is an outlink and in cross domain linking for determining which links should have visitor ID parameter injected.\n\n### Parameters\n\n• **domains**: `string`[]\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescontenttrackingreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ContentTracking\n\n\n\n- [logAllContentBlocksOnPage](#namespacescontenttrackingfunctionslogallcontentblocksonpagemd)\n- [trackAllContentImpressions](#namespacescontenttrackingfunctionstrackallcontentimpressionsmd)\n- [trackContentImpression](#namespacescontenttrackingfunctionstrackcontentimpressionmd)\n- [trackContentImpressionsWithinNode](#namespacescontenttrackingfunctionstrackcontentimpressionswithinnodemd)\n- [trackContentInteraction](#namespacescontenttrackingfunctionstrackcontentinteractionmd)\n- [trackContentInteractionNode](#namespacescontenttrackingfunctionstrackcontentinteractionnodemd)\n- [trackVisibleContentImpressions](#namespacescontenttrackingfunctionstrackvisiblecontentimpressionsmd)\n\n\n\u003ca name=\"namespacescontenttrackingfunctionslogallcontentblocksonpagemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## logAllContentBlocksOnPage()\n\n\u003e **logAllContentBlocksOnPage**(): `void`\n\nPrint all content blocks to the console for debugging purposes\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescontenttrackingfunctionstrackallcontentimpressionsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackAllContentImpressions()\n\n\u003e **trackAllContentImpressions**(): `void`\n\nScans the entire DOM for content blocks and tracks impressions after all page\nelements load. It does not send duplicates on repeated calls unless\ntrackPageView was called in between trackAllContentImpressions invocations\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescontenttrackingfunctionstrackcontentimpressionmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackContentImpression()\n\n\u003e **trackContentImpression**(`contentName`, `contentPiece`, `contentTarget`): `void`\n\n### Parameters\n\n• **contentName**: `string`\n\n• **contentPiece**: `string`\n\n• **contentTarget**: `string`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescontenttrackingfunctionstrackcontentimpressionswithinnodemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackContentImpressionsWithinNode()\n\n\u003e **trackContentImpressionsWithinNode**(`domNode`): `void`\n\n### Parameters\n\n• **domNode**: `Node`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescontenttrackingfunctionstrackcontentinteractionmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackContentInteraction()\n\n\u003e **trackContentInteraction**(`contentInteraction`, `contentName`, `contentPiece`, `contentTarget`): `void`\n\nTracks manual content interaction event\n\n### Parameters\n\n• **contentInteraction**: `string`\n\nType of interaction (e.g. \"click\")\n\n• **contentName**: `string`\n\nName of a content block\n\n• **contentPiece**: `string`\n\nName of the content that was displayed (e.g. link to an image)\n\n• **contentTarget**: `string`\n\nWhere the content leads to (e.g. URL of some external website)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescontenttrackingfunctionstrackcontentinteractionnodemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackContentInteractionNode()\n\n\u003e **trackContentInteractionNode**(`domNode`, `contentInteraction`?): `void`\n\nTracks interaction with a block in domNode. Can be called from code placed in onclick attribute\n\n### Parameters\n\n• **domNode**: `Node`\n\nNode marked as content block or containing content blocks. If content block can’t be found, nothing will tracked.\n\n• **contentInteraction?**: `string`\n\nName of interaction (e.g. \"click\")\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescontenttrackingfunctionstrackvisiblecontentimpressionsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackVisibleContentImpressions()\n\n\u003e **trackVisibleContentImpressions**(`checkOnScroll`?, `watchInterval`?): `void`\n\nScans DOM for all visible content blocks and tracks impressions\n\n### Parameters\n\n• **checkOnScroll?**: `boolean`\n\nWhether to scan for visible content on scroll event\n\n• **watchInterval?**: `number`\n\nDelay, in milliseconds, between scans for new visible content. Periodic checks can be disabled by passing 0\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## CookieManagement\n\n\n\n- [deleteCookies](#namespacescookiemanagementfunctionsdeletecookiesmd)\n- [disableCookies](#namespacescookiemanagementfunctionsdisablecookiesmd)\n- [enableCookies](#namespacescookiemanagementfunctionsenablecookiesmd)\n- [getConfigVisitorCookieTimeout](#namespacescookiemanagementfunctionsgetconfigvisitorcookietimeoutmd)\n- [getCookieDomain](#namespacescookiemanagementfunctionsgetcookiedomainmd)\n- [getCookiePath](#namespacescookiemanagementfunctionsgetcookiepathmd)\n- [getSessionCookieTimeout](#namespacescookiemanagementfunctionsgetsessioncookietimeoutmd)\n- [hasCookies](#namespacescookiemanagementfunctionshascookiesmd)\n- [setCookieDomain](#namespacescookiemanagementfunctionssetcookiedomainmd)\n- [setCookieNamePrefix](#namespacescookiemanagementfunctionssetcookienameprefixmd)\n- [setCookiePath](#namespacescookiemanagementfunctionssetcookiepathmd)\n- [setReferralCookieTimeout](#namespacescookiemanagementfunctionssetreferralcookietimeoutmd)\n- [setSecureCookie](#namespacescookiemanagementfunctionssetsecurecookiemd)\n- [setSessionCookieTimeout](#namespacescookiemanagementfunctionssetsessioncookietimeoutmd)\n- [setVisitorCookieTimeout](#namespacescookiemanagementfunctionssetvisitorcookietimeoutmd)\n- [setVisitorIdCookie](#namespacescookiemanagementfunctionssetvisitoridcookiemd)\n\n\n\u003ca name=\"namespacescookiemanagementfunctionsdeletecookiesmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## deleteCookies()\n\n\u003e **deleteCookies**(): `void`\n\nDeletes existing tracking cookies on the next page view\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementfunctionsdisablecookiesmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## disableCookies()\n\n\u003e **disableCookies**(): `void`\n\nDisables all first party cookies. Existing cookies will be deleted in the next page view\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementfunctionsenablecookiesmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## enableCookies()\n\n\u003e **enableCookies**(): `void`\n\nEnables all first party cookies. Cookies will be created on the next tracking request\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementfunctionsgetconfigvisitorcookietimeoutmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getConfigVisitorCookieTimeout()\n\n\u003e **getConfigVisitorCookieTimeout**(): `Promise`\\\u003c`number`\\\u003e\n\nReturns expiration time of visitor cookies (in milliseconds)\n\n### Returns\n\n`Promise`\\\u003c`number`\\\u003e\n\n\n\u003ca name=\"namespacescookiemanagementfunctionsgetcookiedomainmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getCookieDomain()\n\n\u003e **getCookieDomain**(): `Promise`\\\u003c`string`\\\u003e\n\nReturns domain of the analytics tracking cookies (set with setCookieDomain()).\n\n### Returns\n\n`Promise`\\\u003c`string`\\\u003e\n\n\n\u003ca name=\"namespacescookiemanagementfunctionsgetcookiepathmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getCookiePath()\n\n\u003e **getCookiePath**(): `Promise`\\\u003c`string`\\\u003e\n\nReturns the analytics tracking cookies path\n\n### Returns\n\n`Promise`\\\u003c`string`\\\u003e\n\n\n\u003ca name=\"namespacescookiemanagementfunctionsgetsessioncookietimeoutmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getSessionCookieTimeout()\n\n\u003e **getSessionCookieTimeout**(): `Promise`\\\u003c`number`\\\u003e\n\nReturns expiration time of session cookies\n\n### Returns\n\n`Promise`\\\u003c`number`\\\u003e\n\n\n\u003ca name=\"namespacescookiemanagementfunctionshascookiesmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## hasCookies()\n\n\u003e **hasCookies**(): `Promise`\\\u003c`boolean`\\\u003e\n\nReturns true if cookies are enabled in this browser\n\n### Returns\n\n`Promise`\\\u003c`boolean`\\\u003e\n\n\n\u003ca name=\"namespacescookiemanagementfunctionssetcookiedomainmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setCookieDomain()\n\n\u003e **setCookieDomain**(`domain`): `void`\n\nSets the domain for the analytics tracking cookies\n\n### Parameters\n\n• **domain**: `string`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementfunctionssetcookienameprefixmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setCookieNamePrefix()\n\n\u003e **setCookieNamePrefix**(`prefix`): `void`\n\nSets the prefix for analytics tracking cookies. Default is \"_pk_\".\n\n### Parameters\n\n• **prefix**: `string`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementfunctionssetcookiepathmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setCookiePath()\n\n\u003e **setCookiePath**(`path`): `void`\n\nSets the analytics tracking cookies path\n\n### Parameters\n\n• **path**: `string`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementfunctionssetreferralcookietimeoutmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setReferralCookieTimeout()\n\n\u003e **setReferralCookieTimeout**(`seconds`): `void`\n\nSets the expiration time of referral cookies\n\n### Parameters\n\n• **seconds**: `number`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementfunctionssetsecurecookiemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setSecureCookie()\n\n\u003e **setSecureCookie**(`secure`): `void`\n\nToggles the secure cookie flag on all first party cookies (if you are using HTTPS)\n\n### Parameters\n\n• **secure**: `boolean`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementfunctionssetsessioncookietimeoutmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setSessionCookieTimeout()\n\n\u003e **setSessionCookieTimeout**(`seconds`): `void`\n\nSets the expiration time of session cookies\n\n### Parameters\n\n• **seconds**: `number`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementfunctionssetvisitorcookietimeoutmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setVisitorCookieTimeout()\n\n\u003e **setVisitorCookieTimeout**(`seconds`): `void`\n\nSets the expiration time of visitor cookies\n\n### Parameters\n\n• **seconds**: `number`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescookiemanagementfunctionssetvisitoridcookiemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setVisitorIdCookie()\n\n\u003e **setVisitorIdCookie**(): `void`\n\nSets cookie containing [analytics ID](https://developers.piwik.pro/en/latest/glossary.html#term-analytics-id) in browser\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescrossdomaintrackingreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## CrossDomainTracking\n\n\n#### Type Aliases\n\n- [LinkDecorator](#namespacescrossdomaintrackingtype-aliaseslinkdecoratormd)\n- [VisitorIdGetter](#namespacescrossdomaintrackingtype-aliasesvisitoridgettermd)\n\n\n- [customCrossDomainLinkDecorator](#namespacescrossdomaintrackingfunctionscustomcrossdomainlinkdecoratormd)\n- [customCrossDomainLinkVisitorIdGetter](#namespacescrossdomaintrackingfunctionscustomcrossdomainlinkvisitoridgettermd)\n- [disableCrossDomainLinking](#namespacescrossdomaintrackingfunctionsdisablecrossdomainlinkingmd)\n- [enableCrossDomainLinking](#namespacescrossdomaintrackingfunctionsenablecrossdomainlinkingmd)\n- [getCrossDomainLinkingUrlParameter](#namespacescrossdomaintrackingfunctionsgetcrossdomainlinkingurlparametermd)\n- [isCrossDomainLinkingEnabled](#namespacescrossdomaintrackingfunctionsiscrossdomainlinkingenabledmd)\n- [setCrossDomainLinkingTimeout](#namespacescrossdomaintrackingfunctionssetcrossdomainlinkingtimeoutmd)\n\n\n\u003ca name=\"namespacescrossdomaintrackingfunctionscustomcrossdomainlinkdecoratormd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## customCrossDomainLinkDecorator()\n\n\u003e **customCrossDomainLinkDecorator**(`decorator`): `void`\n\nSets custom cross domains URL decorator for injecting visitor ID into URLs. Used when cross domain linking is enabled.\n\n### Parameters\n\n• **decorator**: [`LinkDecorator`](#namespacescrossdomaintrackingtype-aliaseslinkdecoratormd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescrossdomaintrackingfunctionscustomcrossdomainlinkvisitoridgettermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## customCrossDomainLinkVisitorIdGetter()\n\n\u003e **customCrossDomainLinkVisitorIdGetter**(`getter`): `void`\n\nSets custom cross domain URL parser for extracting visitor ID from URLs. Should extract data injected by URL decorator. The getter should return visitor ID extracted from page URL.\n\n### Parameters\n\n• **getter**: [`VisitorIdGetter`](#namespacescrossdomaintrackingtype-aliasesvisitoridgettermd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescrossdomaintrackingfunctionsdisablecrossdomainlinkingmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## disableCrossDomainLinking()\n\n\u003e **disableCrossDomainLinking**(): `void`\n\nDisables cross domain linking.\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescrossdomaintrackingfunctionsenablecrossdomainlinkingmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## enableCrossDomainLinking()\n\n\u003e **enableCrossDomainLinking**(): `void`\n\nEnables cross domain linking. Visitors across domains configured with \"setDomains\" function will be linked by passing visitor ID parameter in links.\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescrossdomaintrackingfunctionsgetcrossdomainlinkingurlparametermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getCrossDomainLinkingUrlParameter()\n\n\u003e **getCrossDomainLinkingUrlParameter**(): `Promise`\\\u003c`string`\\\u003e\n\nReturns the name of a cross domain URL parameter (query parameter by default) holding visitor ID. This is \"pk_vid\" by default.\n\n### Returns\n\n`Promise`\\\u003c`string`\\\u003e\n\n\n\u003ca name=\"namespacescrossdomaintrackingfunctionsiscrossdomainlinkingenabledmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## isCrossDomainLinkingEnabled()\n\n\u003e **isCrossDomainLinkingEnabled**(): `Promise`\\\u003c`boolean`\\\u003e\n\nReturns boolean telling whether cross domain linking is enabled.\n\n### Returns\n\n`Promise`\\\u003c`boolean`\\\u003e\n\n\n\u003ca name=\"namespacescrossdomaintrackingfunctionssetcrossdomainlinkingtimeoutmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setCrossDomainLinkingTimeout()\n\n\u003e **setCrossDomainLinkingTimeout**(`timeout`): `void`\n\nChanges the time in which two visits across domains will be linked. The default timeout is 180 seconds (3 minutes).\n\n### Parameters\n\n• **timeout**: `number`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescrossdomaintrackingtype-aliaseslinkdecoratormd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Type Alias: LinkDecorator()\n\n\u003e **LinkDecorator**: (`url`, `value`, `name`) =\u003e `string` \\| `null`\n\n### Parameters\n\n• **url**: `string`\n\n• **value**: `string`\n\n• **name**: `string`\n\n### Returns\n\n`string` \\| `null`\n\n\n\u003ca name=\"namespacescrossdomaintrackingtype-aliasesvisitoridgettermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Type Alias: VisitorIdGetter()\n\n\u003e **VisitorIdGetter**: (`url`, `name`) =\u003e `string`\n\n### Parameters\n\n• **url**: `string`\n\n• **name**: `string`\n\n### Returns\n\n`string`\n\n\n\u003ca name=\"namespacescustomdimensionsreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## CustomDimensions\n\n\n\n- [deleteCustomDimension](#namespacescustomdimensionsfunctionsdeletecustomdimensionmd)\n- [getCustomDimensionValue](#namespacescustomdimensionsfunctionsgetcustomdimensionvaluemd)\n- [setCustomDimensionValue](#namespacescustomdimensionsfunctionssetcustomdimensionvaluemd)\n\n\n\u003ca name=\"namespacescustomdimensionsfunctionsdeletecustomdimensionmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## deleteCustomDimension()\n\n\u003e **deleteCustomDimension**(`customDimensionId`): `void`\n\nRemoves a custom dimension with the specified ID.\n\n### Parameters\n\n• **customDimensionId**: `string` \\| `number`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescustomdimensionsfunctionsgetcustomdimensionvaluemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getCustomDimensionValue()\n\n\u003e **getCustomDimensionValue**(`customDimensionId`): `Promise`\\\u003c`string` \\| `undefined`\\\u003e\n\nReturns the value of a custom dimension with the specified ID.\n\n### Parameters\n\n• **customDimensionId**: `string` \\| `number`\n\n### Returns\n\n`Promise`\\\u003c`string` \\| `undefined`\\\u003e\n\n\n\u003ca name=\"namespacescustomdimensionsfunctionssetcustomdimensionvaluemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setCustomDimensionValue()\n\n\u003e **setCustomDimensionValue**(`customDimensionId`, `customDimensionValue`): `void`\n\nSets a custom dimension value to be used later.\n\n### Parameters\n\n• **customDimensionId**: `string` \\| `number`\n\n• **customDimensionValue**: `string`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacescustomeventreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## CustomEvent\n\n\n\n- [trackEvent](#namespacescustomeventfunctionstrackeventmd)\n\n\n\u003ca name=\"namespacescustomeventfunctionstrackeventmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackEvent()\n\n\u003e **trackEvent**(`category`, `action`, `name`?, `value`?, `dimensions`?): `void`\n\nTracks a custom event, e.g. when a visitor interacts with the page\n\n### Parameters\n\n• **category**: `string`\n\n• **action**: `string`\n\n• **name?**: `string`\n\n• **value?**: `number`\n\n• **dimensions?**: [`Dimensions`](#type-aliasesdimensionsmd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesdatalayerreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## DataLayer\n\n\n#### Type Aliases\n\n- [DataLayerEntry](#namespacesdatalayertype-aliasesdatalayerentrymd)\n\n\n- [push](#namespacesdatalayerfunctionspushmd)\n- [setDataLayerName](#namespacesdatalayerfunctionssetdatalayernamemd)\n\n\n\u003ca name=\"namespacesdatalayerfunctionspushmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## push()\n\n\u003e **push**(`data`): `number`\n\nAdds entry to a data layer\n\n### Parameters\n\n• **data**: [`DataLayerEntry`](#namespacesdatalayertype-aliasesdatalayerentrymd)\n\n### Returns\n\n`number`\n\n\n\u003ca name=\"namespacesdatalayerfunctionssetdatalayernamemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setDataLayerName()\n\n\u003e **setDataLayerName**(`name`): `void`\n\n### Parameters\n\n• **name**: `string`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesdatalayertype-aliasesdatalayerentrymd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Type Alias: DataLayerEntry\n\n\u003e **DataLayerEntry**: `Record`\\\u003c`string`, `AnyData`\\\u003e\n\n\n\u003ca name=\"namespacesdownloadandoutlinkreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## DownloadAndOutlink\n\n\n\n- [addDownloadExtensions](#namespacesdownloadandoutlinkfunctionsadddownloadextensionsmd)\n- [enableLinkTracking](#namespacesdownloadandoutlinkfunctionsenablelinktrackingmd)\n- [getLinkTrackingTimer](#namespacesdownloadandoutlinkfunctionsgetlinktrackingtimermd)\n- [removeDownloadExtensions](#namespacesdownloadandoutlinkfunctionsremovedownloadextensionsmd)\n- [setDownloadClasses](#namespacesdownloadandoutlinkfunctionssetdownloadclassesmd)\n- [setDownloadExtensions](#namespacesdownloadandoutlinkfunctionssetdownloadextensionsmd)\n- [setIgnoreClasses](#namespacesdownloadandoutlinkfunctionssetignoreclassesmd)\n- [setLinkClasses](#namespacesdownloadandoutlinkfunctionssetlinkclassesmd)\n- [setLinkTrackingTimer](#namespacesdownloadandoutlinkfunctionssetlinktrackingtimermd)\n- [trackLink](#namespacesdownloadandoutlinkfunctionstracklinkmd)\n\n\n\u003ca name=\"namespacesdownloadandoutlinkfunctionsadddownloadextensionsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## addDownloadExtensions()\n\n\u003e **addDownloadExtensions**(`extensions`): `void`\n\nAdds new extensions to the download extensions list\n\n### Parameters\n\n• **extensions**: `string`[]\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesdownloadandoutlinkfunctionsenablelinktrackingmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## enableLinkTracking()\n\n\u003e **enableLinkTracking**(`trackAlsoMiddleAndRightClicks`?): `void`\n\nEnables automatic link tracking. If called with `true`, left, right and\nmiddle clicks on links will be treated as opening a link. Opening a links to\nan external site (different domain) creates an outlink event. Opening a link\nto a downloadable file creates a download event\n\n### Parameters\n\n• **trackAlsoMiddleAndRightClicks?**: `boolean`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesdownloadandoutlinkfunctionsgetlinktrackingtimermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getLinkTrackingTimer()\n\n\u003e **getLinkTrackingTimer**(): `Promise`\\\u003c`number`\\\u003e\n\nReturns lock/wait time after a request set by setLinkTrackingTimer\n\n### Returns\n\n`Promise`\\\u003c`number`\\\u003e\n\n\n\u003ca name=\"namespacesdownloadandoutlinkfunctionsremovedownloadextensionsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## removeDownloadExtensions()\n\n\u003e **removeDownloadExtensions**(`extensions`): `void`\n\nRemoves extensions from the download extensions list\n\n### Parameters\n\n• **extensions**: `string`[]\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesdownloadandoutlinkfunctionssetdownloadclassesmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setDownloadClasses()\n\n\u003e **setDownloadClasses**(`classes`): `void`\n\nSets a list of class names that indicate whether a list is a download and not an outlink\n\n### Parameters\n\n• **classes**: `string`[]\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesdownloadandoutlinkfunctionssetdownloadextensionsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setDownloadExtensions()\n\n\u003e **setDownloadExtensions**(`extensions`): `void`\n\nOverwrites the list of file extensions indicating that a link is a download\n\n### Parameters\n\n• **extensions**: `string`[]\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesdownloadandoutlinkfunctionssetignoreclassesmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setIgnoreClasses()\n\n\u003e **setIgnoreClasses**(`classes`): `void`\n\nSet a list of class names that indicate a link should not be tracked\n\n### Parameters\n\n• **classes**: `string`[]\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesdownloadandoutlinkfunctionssetlinkclassesmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setLinkClasses()\n\n\u003e **setLinkClasses**(`classes`): `void`\n\nSets a list of class names that indicate whether a link is an outlink and not download\n\n### Parameters\n\n• **classes**: `string`[]\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesdownloadandoutlinkfunctionssetlinktrackingtimermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setLinkTrackingTimer()\n\n\u003e **setLinkTrackingTimer**(`time`): `void`\n\nWhen a visitor produces an events and closes the page immediately afterwards,\ne.g. when opening a link, the request might get cancelled. To avoid loosing\nthe last event this way, JavaScript Tracking Client will lock the page for a\nfraction of a second (if wait time hasn’t passed), giving the request time to\nreach the Collecting \u0026 Processing Pipeline\n\n### Parameters\n\n• **time**: `number`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesdownloadandoutlinkfunctionstracklinkmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackLink()\n\n\u003e **trackLink**(`url`, `linkType`, `dimensions`?, `callback`?): `void`\n\nManually tracks outlink or download event with provided values\n\n### Parameters\n\n• **url**: `string`\n\n• **linkType**: `string`\n\n• **dimensions?**: [`Dimensions`](#type-aliasesdimensionsmd)\n\n• **callback?**\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespaceserrortrackingreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ErrorTracking\n\n\n\n- [enableJSErrorTracking](#namespaceserrortrackingfunctionsenablejserrortrackingmd)\n- [trackError](#namespaceserrortrackingfunctionstrackerrormd)\n\n\n\u003ca name=\"namespaceserrortrackingfunctionsenablejserrortrackingmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## enableJSErrorTracking()\n\n\u003e **enableJSErrorTracking**(`unique`?): `void`\n\nEnables tracking of unhandled JavaScript errors.\n\n### Parameters\n\n• **unique?**: `boolean`\n\ntrack only unique errors\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespaceserrortrackingfunctionstrackerrormd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackError()\n\n\u003e **trackError**(`error`): `void`\n\nAttempts to send error tracking request using same format as native errors caught by enableJSErrorTracking().\nSuch error request will still follow rules set for tracker, so it will be sent only when JS error tracking is enabled\n([enableJSErrorTracking](#namespaceserrortrackingfunctionsenablejserrortrackingmd) function was called before this attempt). It will also respect rules for tracking only unique errors.\n\n### Parameters\n\n• **error**: `Error`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesgoalconversionsreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## GoalConversions\n\n\n\n- [trackGoal](#namespacesgoalconversionsfunctionstrackgoalmd)\n\n\n\u003ca name=\"namespacesgoalconversionsfunctionstrackgoalmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackGoal()\n\n\u003e **trackGoal**(`goalId`, `conversionValue`, `dimensions`?, `options`?): `void`\n\nTracks manual goal conversion\n\n### Parameters\n\n• **goalId**: `string` \\| `number`\n\n• **conversionValue**: `number`\n\n• **dimensions?**: [`Dimensions`](#type-aliasesdimensionsmd)\n\n• **options?**: [`EcommerceOptions`](#type-aliasesecommerceoptionsmd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesheartbeatreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Heartbeat\n\n\n\n- [disableHeartBeatTimer](#namespacesheartbeatfunctionsdisableheartbeattimermd)\n- [enableHeartBeatTimer](#namespacesheartbeatfunctionsenableheartbeattimermd)\n\n\n\u003ca name=\"namespacesheartbeatfunctionsdisableheartbeattimermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## disableHeartBeatTimer()\n\n\u003e **disableHeartBeatTimer**(): `void`\n\nDisables sending heartbeats if they were previously enabled by \"enableHeartBeatTimer\" function.\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesheartbeatfunctionsenableheartbeattimermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## enableHeartBeatTimer()\n\n\u003e **enableHeartBeatTimer**(`delays`?): `void`\n\nWhen a visitor is not producing any events (e.g. because they are reading an article or watching a video), we don’t know if they are still on the page. This might skew page statistics, e.g. time on page value. Heartbeat timer allows us to determine how much time visitors spend on a page by sending heartbeats to the Tracker as long as the page is in focus.\n\n### Parameters\n\n• **delays?**: `number`[]\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesmiscellaneousreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Miscellaneous\n\n\n\n- [setTrackingSourceProvider](#namespacesmiscellaneousfunctionssettrackingsourceprovidermd)\n\n\n\u003ca name=\"namespacesmiscellaneousfunctionssettrackingsourceprovidermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setTrackingSourceProvider()\n\n\u003e **setTrackingSourceProvider**(`provider`, `version`): `void`\n\nAdds metadata about used framework\n\n### Parameters\n\n• **provider**: `string`\n\n• **version**: `string`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacespageviewsreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## PageViews\n\n\n\n- [trackPageView](#namespacespageviewsfunctionstrackpageviewmd)\n\n\n\u003ca name=\"namespacespageviewsfunctionstrackpageviewmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackPageView()\n\n\u003e **trackPageView**(`customPageTitle`?): `void`\n\nTracks a visit on the page that the function was run on\n\n### Parameters\n\n• **customPageTitle?**: `string`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacessitesearchreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## SiteSearch\n\n\n\n- [trackSiteSearch](#namespacessitesearchfunctionstracksitesearchmd)\n\n\n\u003ca name=\"namespacessitesearchfunctionstracksitesearchmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## trackSiteSearch()\n\n\u003e **trackSiteSearch**(`keyword`, `category`?, `searchCount`?, `dimensions`?): `void`\n\nTracks search requests on a website\n\n### Parameters\n\n• **keyword**: `string`\n\n• **category?**: `string`\n\n• **searchCount?**: `number`\n\n• **dimensions?**: [`Dimensions`](#type-aliasesdimensionsmd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesusermanagementreadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## UserManagement\n\n\n\n- [deanonymizeUser](#namespacesusermanagementfunctionsdeanonymizeusermd)\n- [getUserId](#namespacesusermanagementfunctionsgetuseridmd)\n- [getVisitorId](#namespacesusermanagementfunctionsgetvisitoridmd)\n- [getVisitorInfo](#namespacesusermanagementfunctionsgetvisitorinfomd)\n- [resetUserId](#namespacesusermanagementfunctionsresetuseridmd)\n- [setUserId](#namespacesusermanagementfunctionssetuseridmd)\n- [setUserIsAnonymous](#namespacesusermanagementfunctionssetuserisanonymousmd)\n\n\n\u003ca name=\"namespacesusermanagementfunctionsdeanonymizeusermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## deanonymizeUser()\n\n\u003e **deanonymizeUser**(): `void`\n\nDisables anonymous tracking and sends deanonymization event to the Tracker. Recommended method for disabling anonymous tracking.\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesusermanagementfunctionsgetuseridmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getUserId()\n\n\u003e **getUserId**(): `Promise`\\\u003c`string`\\\u003e\n\nThe function that will return user ID\n\n### Returns\n\n`Promise`\\\u003c`string`\\\u003e\n\n\n\u003ca name=\"namespacesusermanagementfunctionsgetvisitoridmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getVisitorId()\n\n\u003e **getVisitorId**(): `Promise`\\\u003c`string`\\\u003e\n\nReturns 16-character hex ID of the visitor\n\n### Returns\n\n`Promise`\\\u003c`string`\\\u003e\n\n\n\u003ca name=\"namespacesusermanagementfunctionsgetvisitorinfomd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## getVisitorInfo()\n\n\u003e **getVisitorInfo**(): `Promise`\\\u003c[`VisitorInfo`](#type-aliasesvisitorinfomd)\\\u003e\n\nReturns visitor information in an array\n\n### Returns\n\n`Promise`\\\u003c[`VisitorInfo`](#type-aliasesvisitorinfomd)\\\u003e\n\n\n\u003ca name=\"namespacesusermanagementfunctionsresetuseridmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## resetUserId()\n\n\u003e **resetUserId**(): `void`\n\nClears previously set userID, e.g. when visitor logs out\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesusermanagementfunctionssetuseridmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setUserId()\n\n\u003e **setUserId**(`userId`): `void`\n\nUser ID is an additional parameter that allows you to aggregate data. When\nset up, you will be able to search through sessions by this parameter, filter\nreports through it or create Multi attribution reports using User ID\n\n### Parameters\n\n• **userId**: `string`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesusermanagementfunctionssetuserisanonymousmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## setUserIsAnonymous()\n\n\u003e **setUserIsAnonymous**(`isAnonymous`): `void`\n\nEnables or disables anonymous tracking (anonymous = without consent). The next emitted event will have anonymous mode set accordingly.\n\n### Parameters\n\n• **isAnonymous**: `boolean`\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesecommercereadmemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## eCommerce\n\n\n\n- [addEcommerceItem](#namespacesecommercefunctionsaddecommerceitemmd)\n- [clearEcommerceCart](#namespacesecommercefunctionsclearecommercecartmd)\n- [ecommerceAddToCart](#namespacesecommercefunctionsecommerceaddtocartmd)\n- [ecommerceCartUpdate](#namespacesecommercefunctionsecommercecartupdatemd)\n- [ecommerceOrder](#namespacesecommercefunctionsecommerceordermd)\n- [ecommerceProductDetailView](#namespacesecommercefunctionsecommerceproductdetailviewmd)\n- [ecommerceRemoveFromCart](#namespacesecommercefunctionsecommerceremovefromcartmd)\n- [getEcommerceItems](#namespacesecommercefunctionsgetecommerceitemsmd)\n- [removeEcommerceItem](#namespacesecommercefunctionsremoveecommerceitemmd)\n- [setEcommerceView](#namespacesecommercefunctionssetecommerceviewmd)\n- [trackEcommerceCartUpdate](#namespacesecommercefunctionstrackecommercecartupdatemd)\n- [trackEcommerceOrder](#namespacesecommercefunctionstrackecommerceordermd)\n\n\n\u003ca name=\"namespacesecommercefunctionsaddecommerceitemmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ~~addEcommerceItem()~~\n\n\u003e **addEcommerceItem**(`productSKU`, `productName`, `productCategory`, `productPrice`, `productQuantity`): `void`\n\n### Parameters\n\n• **productSKU**: `string`\n\n• **productName**: `string`\n\n• **productCategory**: `string` \\| `string`[]\n\n• **productPrice**: `number`\n\n• **productQuantity**: `number`\n\n### Returns\n\n`void`\n\n### Deprecated\n\nPlease use the ecommerceAddToCart instead.\n\n\n\u003ca name=\"namespacesecommercefunctionsclearecommercecartmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ~~clearEcommerceCart()~~\n\n\u003e **clearEcommerceCart**(): `void`\n\n### Returns\n\n`void`\n\n### Deprecated\n\n\n\u003ca name=\"namespacesecommercefunctionsecommerceaddtocartmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ecommerceAddToCart()\n\n\u003e **ecommerceAddToCart**(`products`, `options`?): `void`\n\nTracks action of adding products to a cart\n\n### Parameters\n\n• **products**: [`Product`](#type-aliasesproductmd)[]\n\n• **options?**: [`EcommerceOptions`](#type-aliasesecommerceoptionsmd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesecommercefunctionsecommercecartupdatemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ecommerceCartUpdate()\n\n\u003e **ecommerceCartUpdate**(`products`, `grandTotal`, `options`?): `void`\n\nTracks current state of a cart\n\n### Parameters\n\n• **products**: [`Product`](#type-aliasesproductmd)[]\n\n• **grandTotal**: `string` \\| `number`\n\n• **options?**: [`EcommerceOptions`](#type-aliasesecommerceoptionsmd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesecommercefunctionsecommerceordermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ecommerceOrder()\n\n\u003e **ecommerceOrder**(`products`, `paymentInformation`, `options`?): `void`\n\nTracks conversion, including products and payment details\n\n### Parameters\n\n• **products**: [`Product`](#type-aliasesproductmd)[]\n\n• **paymentInformation**: [`PaymentInformation`](#type-aliasespaymentinformationmd)\n\n• **options?**: [`EcommerceOptions`](#type-aliasesecommerceoptionsmd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesecommercefunctionsecommerceproductdetailviewmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ecommerceProductDetailView()\n\n\u003e **ecommerceProductDetailView**(`products`, `options`?): `void`\n\nTracks action of viewing product page\n\n### Parameters\n\n• **products**: [`Product`](#type-aliasesproductmd)[]\n\n• **options?**: [`EcommerceOptions`](#type-aliasesecommerceoptionsmd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesecommercefunctionsecommerceremovefromcartmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ecommerceRemoveFromCart()\n\n\u003e **ecommerceRemoveFromCart**(`products`, `options`?): `void`\n\nTracks action of removing a products from a cart\n\n### Parameters\n\n• **products**: [`Product`](#type-aliasesproductmd)[]\n\n• **options?**: [`EcommerceOptions`](#type-aliasesecommerceoptionsmd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"namespacesecommercefunctionsgetecommerceitemsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ~~getEcommerceItems()~~\n\n\u003e **getEcommerceItems**(): `Promise`\\\u003c`object`\\\u003e\n\n### Returns\n\n`Promise`\\\u003c`object`\\\u003e\n\n### Deprecated\n\n\n\u003ca name=\"namespacesecommercefunctionsremoveecommerceitemmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ~~removeEcommerceItem()~~\n\n\u003e **removeEcommerceItem**(`productSKU`): `void`\n\n### Parameters\n\n• **productSKU**: `string`\n\n### Returns\n\n`void`\n\n### Deprecated\n\nPlease use the ecommerceRemoveFromCart instead.\n\n\n\u003ca name=\"namespacesecommercefunctionssetecommerceviewmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ~~setEcommerceView()~~\n\n\u003e **setEcommerceView**(`productSKU`, `productName`?, `productCategory`?, `productPrice`?): `void`\n\n### Parameters\n\n• **productSKU**: `string`\n\n• **productName?**: `string`\n\n• **productCategory?**: `string`[]\n\n• **productPrice?**: `string`\n\n### Returns\n\n`void`\n\n### Deprecated\n\n\n\u003ca name=\"namespacesecommercefunctionstrackecommercecartupdatemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ~~trackEcommerceCartUpdate()~~\n\n\u003e **trackEcommerceCartUpdate**(`cartAmount`): `void`\n\n### Parameters\n\n• **cartAmount**: `number`\n\n### Returns\n\n`void`\n\n### Deprecated\n\nPlease use the ecommerceCartUpdate instead.\n\n\n\u003ca name=\"namespacesecommercefunctionstrackecommerceordermd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## ~~trackEcommerceOrder()~~\n\n\u003e **trackEcommerceOrder**(`orderId`, `orderGrandTotal`, `orderSubTotal`?, `orderTax`?, `orderShipping`?, `orderDiscount`?): `void`\n\n### Parameters\n\n• **orderId**: `string`\n\n• **orderGrandTotal**: `number`\n\n• **orderSubTotal?**: `number`\n\n• **orderTax?**: `number`\n\n• **orderShipping?**: `number`\n\n• **orderDiscount?**: `number`\n\n### Returns\n\n`void`\n\n### Deprecated\n\nPlease use the ecommerceOrder instead.\n\n\n\u003ca name=\"type-aliasesdimensionsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Type Alias: Dimensions\n\n\u003e **Dimensions**: `Record`\\\u003c\\`dimension$\\{number\\}\\`, `string`\\\u003e\n\n\n\u003ca name=\"type-aliasesecommerceoptionsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Type Alias: EcommerceOptions\n\n\u003e **EcommerceOptions**: `object`\n\n### Type declaration\n\n#### currencyCode?\n\n\u003e `optional` **currencyCode**: `string`\n\nCurrency code in [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format. If not provided, the currency set in app settings will be used instead.\n\n\n\u003ca name=\"type-aliasesinitoptionsmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Type Alias: InitOptions\n\n\u003e **InitOptions**: `object`\n\n### Type declaration\n\n#### dataLayerName?\n\n\u003e `optional` **dataLayerName**: `string`\n\nDefaults to 'dataLayer'\n\n#### nonce?\n\n\u003e `optional` **nonce**: `string`\n\n\n\u003ca name=\"type-aliasesinitializemd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Type Alias: Initialize()\n\n\u003e **Initialize**: (`containerId`, `containerUrl`, `nonceOrOptions`?) =\u003e `void`\n\n### Parameters\n\n• **containerId**: `string`\n\n• **containerUrl**: `string`\n\n• **nonceOrOptions?**: `string` \\| [`InitOptions`](#type-aliasesinitoptionsmd)\n\n### Returns\n\n`void`\n\n\n\u003ca name=\"type-aliasespaymentinformationmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Type Alias: PaymentInformation\n\n\u003e **PaymentInformation**: `object`\n\n### Type declaration\n\n#### discount?\n\n\u003e `optional` **discount**: `number` \\| `string`\n\n#### grandTotal\n\n\u003e **grandTotal**: `number` \\| `string`\n\n#### orderId\n\n\u003e **orderId**: `string`\n\n#### shipping?\n\n\u003e `optional` **shipping**: `number` \\| `string`\n\n#### subTotal?\n\n\u003e `optional` **subTotal**: `number` \\| `string`\n\n#### tax?\n\n\u003e `optional` **tax**: `number` \\| `string`\n\n\n\u003ca name=\"type-aliasesproductmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Type Alias: Product\n\n\u003e **Product**: `object`\n\n### Type declaration\n\n#### brand?\n\n\u003e `optional` **brand**: `string`\n\n#### category?\n\n\u003e `optional` **category**: `LimitedArrayFiveStrings`\n\n#### customDimensions?\n\n\u003e `optional` **customDimensions**: `Record`\\\u003c`number`, `string`\\\u003e\n\n#### name?\n\n\u003e `optional` **name**: `string`\n\n#### price?\n\n\u003e `optional` **price**: `number`\n\n#### quantity?\n\n\u003e `optional` **quantity**: `number`\n\n#### sku\n\n\u003e **sku**: `string`\n\n#### variant?\n\n\u003e `optional` **variant**: `string`\n\n\n\u003ca name=\"type-aliasesvisitorinfomd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Type Alias: VisitorInfo\n\n\u003e **VisitorInfo**: [`\"0\"` \\| `\"1\"`, `string`, `number`, `string` \\| `number`, `number`, `number` \\| `\"\"`, `number` \\| `\"\"`]\n\n\n\u003ca name=\"variablesdefaultmd\"\u003e\u003c/a\u003e\n\n\n***\n\n\n## Variable: default\n\n\u003e `const` **default**: `object`\n\n### Type declaration\n\n#### getInitScript\n\n\u003e **getInitScript**: *typeof* `PiwikPro.getInitScript`\n\n#### initialize\n\n\u003e **initialize**: [`Initialize`](#type-aliasesinitializemd)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPiwikPRO%2Fngx-piwik-pro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPiwikPRO%2Fngx-piwik-pro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPiwikPRO%2Fngx-piwik-pro/lists"}