import { Inject , Injectable } from '@angular/core' ; import { MATOMO_CONFIGURATION , MatomoModuleConfiguration } from './matomo-configuration' ; /**
 * Access to the global window variable.
 */ declare var window ; /**
 * Matomo scope
 */ type MatomoScope = 'page' | 'visit' | 'event' ; export @ Injectable ( ) export class MatomoTracker { param configuration constructor ( @ Inject ( MATOMO_CONFIGURATION ) private readonly configuration ) { try { if ( typeof window . _paq === 'undefined' ) { console . warn ( 'Matomo has not yet been initialized!' ) ; } } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param customTitle trackPageView ( customTitle ? ) { try { const args = [ ] ; if ( ! ! customTitle ) { args . push ( customTitle ) ; } window . _paq . push ( [ 'trackPageView' , ... args ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param category param action param name param value trackEvent ( category , action , name ? , value ? ) { try { const args = [ category , action ] ; if ( ! ! name ) { args . push ( name ) ; if ( typeof value === 'number' ) { args . push ( value ) ; } } window . _paq . push ( [ 'trackEvent' , ... args ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param keyword param category param resultsCount trackSiteSearch ( keyword , category ? , resultsCount ? ) { try { const args = [ keyword ] ; if ( ! ! category ) { args . push ( category ) ; if ( typeof resultsCount === 'number' ) { args . push ( resultsCount ) ; } } window . _paq . push ( [ 'trackSiteSearch' , ... args ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param idGoal param customRevenue trackGoal ( idGoal , customRevenue ? ) { try { const args = [ idGoal ] ; if ( typeof customRevenue === 'number' ) { args . push ( customRevenue ) ; } window . _paq . push ( [ 'trackGoal' , ... args ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param url param linkType trackLink ( url , linkType ) { try { window . _paq . push ( [ 'trackLink' , url , linkType ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } see https trackAllContentImpressions ( ) { try { window . _paq . push ( [ 'trackAllContentImpressions' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param checkOnScroll param timeInterval see https trackVisibleContentImpressions ( checkOnScroll , timeInterval ) { try { window . _paq . push ( [ 'trackVisibleContentImpressions' , checkOnScroll , timeInterval ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param node see https trackContentImpressionsWithinNode ( node ) { try { window . _paq . push ( [ 'trackContentImpressionsWithinNode' , node ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param node param contentInteraction see https trackContentInteractionNode ( node , contentInteraction ) { try { window . _paq . push ( [ 'trackContentInteractionNode' , node , contentInteraction ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param contentName param contentPiece param contentTarget see https trackContentImpression ( contentName , contentPiece , contentTarget ) { try { window . _paq . push ( [ 'trackContentImpression' , contentName , contentPiece , contentTarget ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param contentInteraction param contentName param contentPiece param contentTarget see https trackContentInteraction ( contentInteraction , contentName , contentPiece , contentTarget ) { try { window . _paq . push ( [ 'trackContentInteraction' , contentInteraction , contentName , contentPiece , contentTarget , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Logs all found content blocks within a page to the console.<br />
     * This is useful to debug / test content tracking.
     */ logAllContentBlocksOnPage ( ) { try { window . _paq . push ( [ 'logAllContentBlocksOnPage' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Sends a ping request.<br />
     * Ping requests do not track new actions.
     * If they are sent within the standard visit length, they will extend the existing visit and the current last action for the visit.
     * If sent after the standard visit length, ping requests will create a new visit using the last action in the last known visit.<br />
     * See also enableHeartBeatTimer.
     */ ping ( ) { try { window . _paq . push ( [ 'ping' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param delay enableHeartBeatTimer ( delay ) { try { window . _paq . push ( [ 'enableHeartBeatTimer' , delay ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param enable enableLinkTracking ( enable = false ) { try { window . _paq . push ( [ 'enableLinkTracking' , enable ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } see https enableCrossDomainLinking ( ) { try { window . _paq . push ( [ 'enableCrossDomainLinking' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param timeout see https setCrossDomainLinkingTimeout ( timeout ) { try { window . _paq . push ( [ 'setCrossDomainLinkingTimeout' , timeout ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } returns see https getCrossDomainLinkingUrlParameter ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getCrossDomainLinkingUrlParameter ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } param title setDocumentTitle ( title ) { try { window . _paq . push ( [ 'setDocumentTitle' , title ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param domains see https setDomains ( domains ) { try { window . _paq . push ( [ 'setDomains' , domains ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param url setCustomUrl ( url ) { try { window . _paq . push ( [ 'setCustomUrl' , url ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param url setReferrerUrl ( url ) { try { window . _paq . push ( [ 'setReferrerUrl' , url ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param siteId setSiteId ( siteId ) { try { window . _paq . push ( [ 'setSiteId' , siteId ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param url setApiUrl ( url ) { try { window . _paq . push ( [ 'setApiUrl' , url ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param url setTrackerUrl ( url ) { try { window . _paq . push ( [ 'setTrackerUrl' , url ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } returns getMatomoUrl ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getPiwikUrl ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } returns getCurrentUrl ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getCurrentUrl ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } param classes setDownloadClasses ( classes ) { try { window . _paq . push ( [ 'setDownloadClasses' , classes ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param extensions setDownloadExtensions ( extensions ) { try { window . _paq . push ( [ 'setDownloadClasses' , extensions ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param extensions addDownloadExtensions ( extensions ) { try { window . _paq . push ( [ 'setDownloadClasses' , extensions ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param extensions removeDownloadExtensions ( extensions ) { try { window . _paq . push ( [ 'setDownloadClasses' , extensions ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param classes setIgnoreClasses ( classes ) { try { window . _paq . push ( [ 'setDownloadClasses' , classes ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param classes setLinkClasses ( classes ) { try { window . _paq . push ( [ 'setDownloadClasses' , classes ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param delay setLinkTrackingTimer ( delay ) { try { window . _paq . push ( [ 'setLinkTrackingTimer' , delay ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } returns getLinkTrackingTimer ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getLinkTrackingTimer ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } param value discardHashTag ( value ) { try { window . _paq . push ( [ 'discardHashTag' , value ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param generationTime setGenerationTimeMs ( generationTime ) { if ( this . configuration . scriptVersion < 4 ) { try { window . _paq . push ( [ 'setGenerationTimeMs' , generationTime ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } } param appendToUrl appendToTrackingUrl ( appendToUrl ) { try { window . _paq . push ( [ 'appendToTrackingUrl' , appendToUrl ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Enables a frame-buster to prevent the tracked web page from being framed/iframed.
     */ killFrame ( ) { try { window . _paq . push ( [ 'killFrame' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param url redirectFile ( url ) { try { window . _paq . push ( [ 'redirectFile' , url ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param minimumVisitLength param heartBeatDelay see https setHeartBeatTimer ( minimumVisitLength , heartBeatDelay ) { try { window . _paq . push ( [ 'setHeartBeatTimer' , minimumVisitLength , heartBeatDelay ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } returns getVisitorId ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getVisitorId ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } returns getVisitorInfo ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getVisitorInfo ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } returns getAttributionInfo ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getAttributionInfo ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } returns getAttributionCampaignName ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getAttributionCampaignName ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } returns getAttributionCampaignKeyword ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getAttributionCampaignKeyword ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } returns getAttributionReferrerTimestamp ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getAttributionReferrerTimestamp ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } returns getAttributionReferrerUrl ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getAttributionReferrerUrl ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } returns see https getUserId ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getUserId ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } param userId see https setUserId ( userId ) { try { window . _paq . push ( [ 'setUserId' , userId ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } see https resetUserId ( ) { try { window . _paq . push ( [ 'resetUserId' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param index param name param value param scope see https setCustomVariable ( index , name , value , scope ) { try { window . _paq . push ( [ 'setCustomVariable' , index , name , value , scope ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param index param scope see https deleteCustomVariable ( index , scope ) { try { window . _paq . push ( [ 'deleteCustomVariable' , index , scope ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param scope see https deleteCustomVariables ( scope ) { try { window . _paq . push ( [ 'deleteCustomVariables' , scope ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param index param scope returns see https getCustomVariable ( index , scope ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getCustomVariable ( index , scope ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } see https storeCustomVariablesInCookie ( ) { try { window . _paq . push ( [ 'storeCustomVariablesInCookie' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param customDimensionId param customDimensionValue see https setCustomDimension ( customDimensionId , customDimensionValue ) { try { window . _paq . push ( [ 'setCustomDimension' , customDimensionId , customDimensionValue ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param customDimensionId see https deleteCustomDimension ( customDimensionId ) { try { window . _paq . push ( [ 'deleteCustomDimension' , customDimensionId ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param customDimensionId returns see https getCustomDimension ( customDimensionId ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getCustomDimension ( customDimensionId ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } param name see https setCampaignNameKey ( name ) { try { window . _paq . push ( [ 'setCampaignNameKey' , name ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param keyword see https setCampaignKeywordKey ( keyword ) { try { window . _paq . push ( [ 'setCampaignKeywordKey' , keyword ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param conversionToFirstReferrer see https see https setConversionAttributionFirstReferrer ( conversionToFirstReferrer ) { try { window . _paq . push ( [ 'setConversionAttributionFirstReferrer' , conversionToFirstReferrer ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param productSKU param productName param productCategory param price setEcommerceView ( productSKU , productName , productCategory , price ) { try { window . _paq . push ( [ 'setEcommerceView' , productSKU , productName , productCategory , price ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param productSKU param productName param productCategory param price param quantity addEcommerceItem ( productSKU , productName ? , productCategory ? , price ? , quantity ? ) { try { const args = [ productSKU ] ; if ( ! ! productName ) { args . push ( productName ) ; if ( ! ! productCategory ) { args . push ( productCategory ) ; if ( typeof price === 'number' ) { args . push ( price ) ; if ( typeof quantity === 'number' ) { args . push ( quantity ) ; } } } } window . _paq . push ( [ 'addEcommerceItem' , ... args ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param productSKU removeEcommerceItem ( productSKU ) { try { const args = [ productSKU ] ; window . _paq . push ( [ 'removeEcommerceItem' , ... args ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Removes all products in the untracked ecommerce order.<br />
     * Note: this is done automatically after trackEcommerceOrder() is called.
     */ clearEcommerceCart ( ) { try { window . _paq . push ( [ 'clearEcommerceCart' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Returns all ecommerce items currently in the untracked ecommerce order.
     * The returned array will be a copy, so changing it won't affect the ecommerce order.<br />
     * To affect what gets tracked, use the addEcommerceItem()/removeEcommerceItem()/clearEcommerceCart() methods.<br />
     * Use this method to see what will be tracked before you track an order or cart update.
     */ getEcommerceItems ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . getEcommerceItems ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } param grandTotal trackEcommerceCartUpdate ( grandTotal ) { try { window . _paq . push ( [ 'trackEcommerceCartUpdate' , grandTotal ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param orderId param grandTotal param subTotal param tax param shipping param discount trackEcommerceOrder ( orderId , grandTotal , subTotal ? , tax ? , shipping ? , discount ? ) { try { const args = [ orderId , grandTotal ] ; if ( typeof subTotal === 'number' ) { args . push ( subTotal ) ; if ( typeof tax === 'number' ) { args . push ( tax ) ; if ( typeof shipping === 'number' ) { args . push ( shipping ) ; if ( typeof discount === 'number' || typeof discount === 'boolean' ) { args . push ( discount ) ; } } } } window . _paq . push ( [ 'trackEcommerceOrder' , ... args ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * By default the Matomo tracker assumes consent to tracking.
     * To change this behavior so nothing is tracked until a user consents, you must call requireConsent.
     */ requireConsent ( ) { try { window . _paq . push ( [ 'requireConsent' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Require user cookie consent before storing and using any cookies.
     */ requireCookieConsent ( ) { try { window . _paq . push ( [ 'requireCookieConsent' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Marks that the current user has consented.<br />
     * The consent is one-time only, so in a subsequent browser session, the user will have to consent again.<br />
     * To remember consent, see the method below: rememberConsentGiven.
     */ setConsentGiven ( ) { try { window . _paq . push ( [ 'setConsentGiven' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Marks that the current user has consented to store and use cookies.<br />
     * The consent is one-time only, so in a subsequent browser session, the user will have to consent again.<br />
     * To remember consent, see the method below: rememberCookieConsentGiven.
     */ setCookieConsentGiven ( ) { try { window . _paq . push ( [ 'setCookieConsentGiven' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param hoursToExpire rememberConsentGiven ( hoursToExpire ? ) { try { const args = [ ] ; if ( typeof hoursToExpire === 'number' ) { args . push ( hoursToExpire ) ; } window . _paq . push ( [ 'rememberConsentGiven' , ... args ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param hoursToExpire rememberCookieConsentGiven ( hoursToExpire ? ) { try { const args = [ ] ; if ( typeof hoursToExpire === 'number' ) { args . push ( hoursToExpire ) ; } window . _paq . push ( [ 'rememberCookieConsentGiven' , ... args ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Removes a user's consent, both if the consent was one-time only and if the consent was remembered.<br />
     * This makes sure the cookie that remembered the given consent is deleted.<br />
     * After calling this method, the user will have to consent again in order to be tracked.
     */ forgetConsentGiven ( ) { try { window . _paq . push ( [ 'forgetConsentGiven' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Removes a user's consent, both if the consent was one-time only and if the consent was remembered.<br />
     * This makes sure the cookie that remembered the given consent is deleted.<br />
     * After calling this method, the user will have to consent again in order to be tracked.
     */ forgetCookieConsentGiven ( ) { try { window . _paq . push ( [ 'forgetCookieConsentGiven' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param doNotTrack see https setDoNotTrack ( doNotTrack ) { try { window . _paq . push ( [ 'setDoNotTrack' , doNotTrack ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Disables all first party cookies.<br />
     * Existing Matomo cookies for this websites will be deleted on the next page view.
     */ disableCookies ( ) { try { window . _paq . push ( [ 'disableCookies' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Deletes the tracking cookies currently set (useful when creating new visits).
     */ deleteCookies ( ) { try { window . _paq . push ( [ 'deleteCookies' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } returns hasCookies ( ) { return new Promise ( ( resolve , reject ) => { try { window . _paq . push ( [ function ( this ) : void { resolve ( this . hasCookies ( ) ) ; } , ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { reject ( e ) ; } } } ) ; } param prefix setCookieNamePrefix ( prefix ) { try { window . _paq . push ( [ 'setCookieNamePrefix' , prefix ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param domain setCookieDomain ( domain ) { try { window . _paq . push ( [ 'setCookieDomain' , domain ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param path setCookiePath ( path ) { try { window . _paq . push ( [ 'setCookiePath' , path ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param secure setSecureCookie ( secure ) { try { window . _paq . push ( [ 'setSecureCookie' , secure ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param timeout setVisitorCookieTimeout ( timeout ) { try { window . _paq . push ( [ 'setVisitorCookieTimeout' , timeout ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param timeout setReferralCookieTimeout ( timeout ) { try { window . _paq . push ( [ 'setReferralCookieTimeout' , timeout ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param timeout setSessionCookieTimeout ( timeout ) { try { window . _paq . push ( [ 'setSessionCookieTimeout' , timeout ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param element addListener ( element ) { try { window . _paq . push ( [ 'addListener' , element ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param method setRequestMethod ( method ) { try { window . _paq . push ( [ 'setRequestMethod' , method ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param callback setCustomRequestProcessing ( callback ) { try { window . _paq . push ( [ 'setCustomRequestProcessing' , callback ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } param contentType setRequestContentType ( contentType ) { try { window . _paq . push ( [ 'setRequestContentType' , contentType ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } /**
     * Disables the feature which groups together multiple tracking requests and send them as a bulk POST request.<br />
     * Disabling this feature is useful when you want to be able to replay all logs: one must use disableQueueRequest
     * to disable this behavior to later be able to replay logged Matomo logs (otherwise a subset of the requests
     * wouldn't be able to be replayed).
     */ disableQueueRequest ( ) { try { window . _paq . push ( [ 'disableQueueRequest' ] ) ; } catch ( e ) { if ( ! ( e instanceof ReferenceError ) ) { throw e ; } } } }