ngx-matomo-client
Version:
Matomo (fka. Piwik) client for Angular applications
92 lines (86 loc) • 4.06 kB
TypeScript
import * as i0 from '@angular/core';
import { EnvironmentProviders, ModuleWithProviders, InjectionToken } from '@angular/core';
import * as i1 from 'ngx-matomo-client/core';
import { MatomoConfiguration, MatomoFeature, MatomoTracker, MatomoInstance, MatomoECommerceItem } from 'ngx-matomo-client/core';
/**
* Set up a no-op Matomo tracker. Useful for testing scenario.
*
*
* Testing tracker is available as both {@link MatomoTracker} and {@link MatomoTestingTracker} injection tokens,
* the latter allowing to customize testing behavior (see {@link MatomoTestingTracker}).
*
* @see MatomoTestingTracker
*/
declare function provideMatomoTesting(config?: Partial<MatomoConfiguration> | (() => Partial<MatomoConfiguration>), ...features: MatomoFeature[]): EnvironmentProviders;
declare class MatomoTestingModule {
static forRoot(): ModuleWithProviders<MatomoTestingModule>;
static ɵfac: i0.ɵɵFactoryDeclaration<MatomoTestingModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<MatomoTestingModule, never, [typeof i1.MatomoTrackerDirective, typeof i1.MatomoTrackClickDirective, typeof i1.MatomoOptOutFormComponent], [typeof i1.MatomoTrackerDirective, typeof i1.MatomoTrackClickDirective, typeof i1.MatomoOptOutFormComponent]>;
static ɵinj: i0.ɵɵInjectorDeclaration<MatomoTestingModule>;
}
/**
* No-op implementation of {@link MatomoTracker}
*
* All commands are memoized and can later be retrieved using
* {@link getAllCommands getAllCommands()} or {@link getCommand getCommand(index)}.
*
* All <i>getter</i> methods will immediately resolve to an <i>empty value</i>.
* This can be customized by setting a custom Matomo instance with {@link setMatomoInstance setMatomoInstance()}.
*/
declare class MatomoTestingTracker extends MatomoTracker {
#private;
/** Retrieve the current Matomo instance */
getMatomoInstance(): MatomoInstance;
/**
* Set the current matomo instance
*
* @deprecated will be removed in a future version and injected from DI token `MATOMO_TESTING_INSTANCE` instead
* @see MATOMO_TESTING_INSTANCE
*/
setMatomoInstance(instance: MatomoInstance): void;
/** Retrieve all memoized commands */
getAllCommands(): unknown[][];
/** Retrieve nth memoized command */
getCommand(index: number): unknown[] | undefined;
/** Clear all memoized commands */
reset(): void;
protected push(command: unknown[]): void;
protected pushFn<T>(fn: (matomo: MatomoInstance) => T): Promise<T>;
static ɵfac: i0.ɵɵFactoryDeclaration<MatomoTestingTracker, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<MatomoTestingTracker>;
}
declare const MATOMO_TESTING_INSTANCE: InjectionToken<MatomoInstance>;
/**
* No-op implementation of {@link MatomoInstance}
*/
declare class MatomoTestingInstance implements MatomoInstance {
areCookiesEnabled(): boolean;
getAttributionCampaignKeyword(): string;
getAttributionCampaignName(): string;
getAttributionInfo(): string[];
getAttributionReferrerTimestamp(): string;
getAttributionReferrerUrl(): string;
getCrossDomainLinkingUrlParameter(): string;
getCurrentUrl(): string;
getCustomDimension(_customDimensionId: number): string;
getCustomPagePerformanceTiming(): string;
getCustomVariable(_index: number, _scope: string): string;
getEcommerceItems(): MatomoECommerceItem[];
getExcludedReferrers(): string[];
getLinkTrackingTimer(): number;
getMatomoUrl(): string;
getPageViewId(): string;
getCustomData(): unknown;
getPiwikUrl(): string;
getRememberedConsent(): number | string;
getRememberedCookieConsent(): number | string;
getUserId(): string;
getVisitorId(): string;
getVisitorInfo(): unknown[];
hasCookies(): boolean;
hasRememberedConsent(): boolean;
isConsentRequired(): boolean;
isUserOptedOut(): boolean;
getIgnoreCampaignsForReferrers(): string[];
}
export { MATOMO_TESTING_INSTANCE, MatomoTestingInstance, MatomoTestingModule, MatomoTestingTracker, provideMatomoTesting };