import { PirschClientConfig, PirschHit, PirschDomain, PirschFilter, PirschKeyword, PirschScreenClassStats, PirschPlatformStats, PirschCountryStats, PirschBrowserStats, PirschOSStats, PirschReferrerStats, PirschLanguageStats, PirschVisitorHourStats, PirschActiveVisitorsData, PirschGrowth, PirschConversionGoal, PirschEventStats, PirschPageStats, PirschVisitorStats, PirschUTMTermStats, PirschUTMContentStats, PirschUTMCampaignStats, PirschUTMMediumStats, PirschUTMSourceStats, PirschTimeSpentStats, PirschTotalVisitorStats, PirschEventListStats, PirschOSVersionStats, PirschBrowserVersionStats, PirschEntryStats, PirschExitStats, PirschCityStats, PirschHttpOptions, PirschAccessMode, Scalar, Optional, PirschSession, PirschBatchHit, PirschBatchSession, TagStats, PirschRegionStats, FunnelData, Funnel } from "./types"; import { PirschApiError, PirschCommon } from "./common"; export declare abstract class PirschCoreClient extends PirschCommon { protected readonly version = "v1"; protected readonly endpoint = "api"; protected readonly clientId?: string; protected readonly clientSecret?: string; protected readonly baseUrl: string; protected readonly timeout: number; protected readonly accessMode: PirschAccessMode; protected accessToken: string; /** * The constructor creates a new client. * * @param {object} configuration You need to pass in the **Client ID** and **Client Secret** or **Access Key** you have configured on the Pirsch dashboard. * It's also recommended to set the proper protocol for your website, else it will be set to `https` by default. * All other configuration parameters can be left to their defaults. * @param {string} configuration.baseUrl The base URL for the pirsch API * @param {number} configuration.timeout The default HTTP timeout in milliseconds * @param {string} configuration.clientId The OAuth client ID * @param {string} configuration.clientSecret The OAuth client secret * @param {string} configuration.protocol The default HTTP protocol to use for tracking * */ constructor(configuration: PirschClientConfig); /** * hit sends a hit to Pirsch. Make sure you call it in all request handlers you want to track. * Also, make sure to filter out unwanted pathnames (like /favicon.ico in your root handler for example). * * @param hit all required data for the request. * @returns APIError or an empty promise, in case something went wrong */ hit(hit: PirschHit): Promise>; /** * batchHit sends batched hits to Pirsch. * * @param hits all required data for the request. * @returns APIError or an empty promise, in case something went wrong */ batchHits(hits: PirschBatchHit[]): Promise>; /** * event sends an event to Pirsch. Make sure you call it in all request handlers you want to track. * Also, make sure to filter out unwanted pathnames (like /favicon.ico in your root handler for example). * * @param name the name for the event * @param hit all required data for the request * @param duration optional duration for the event * @param meta optional object containing metadata (only scalar values, like strings, numbers, and booleans) * @returns APIError or an empty promise, in case something went wrong */ event(name: string, hit: PirschHit, duration?: number, meta?: Record): Promise>; /** * batchEvents sends batched events to Pirsch. * * @param events all required data for the request. * @returns APIError or an empty promise, in case something went wrong */ batchEvents(events: { name: string; hit: PirschHit; time: string; duration?: number; meta?: Record; }[]): Promise>; /** * session keeps a session alive. * * @param session all required data for the request. * @returns APIError or an empty promise, in case something went wrong */ session(session: PirschSession): Promise>; /** * batchSessions keeps batched sessions alive. * * @param sessions all required data for the request. * @returns APIError or an empty promise, in case something went wrong */ batchSessions(sessions: PirschBatchSession[]): Promise>; /** * domain returns the domain for this client. * * @returns Domain object for this client. */ domain(): Promise; /** * sessionDuration returns the session duration grouped by day. * * @param filter used to filter the result set. */ sessionDuration(filter: PirschFilter): Promise; /** * timeOnPage returns the time spent on pages. * * @param filter used to filter the result set. */ timeOnPage(filter: PirschFilter): Promise; /** * utmSource returns the utm sources. * * @param filter used to filter the result set. */ utmSource(filter: PirschFilter): Promise; /** * utmMedium returns the utm medium. * * @param filter used to filter the result set. */ utmMedium(filter: PirschFilter): Promise; /** * utmCampaign returns the utm campaigns. * * @param filter used to filter the result set. */ utmCampaign(filter: PirschFilter): Promise; /** * utmContent returns the utm content. * * @param filter used to filter the result set. */ utmContent(filter: PirschFilter): Promise; /** * utmTerm returns the utm term. * * @param filter used to filter the result set. */ utmTerm(filter: PirschFilter): Promise; /** * totalVisitors returns the total visitor statistics. * * @param filter used to filter the result set. */ totalVisitors(filter: PirschFilter): Promise; /** * visitors returns the visitor statistics grouped by day. * * @param filter used to filter the result set. */ visitors(filter: PirschFilter): Promise; /** * entryPages returns the entry page statistics grouped by page. * * @param filter used to filter the result set. */ entryPages(filter: PirschFilter): Promise; /** * exitPages returns the exit page statistics grouped by page. * * @param filter used to filter the result set. */ exitPages(filter: PirschFilter): Promise; /** * pages returns the page statistics grouped by page. * * @param filter used to filter the result set. */ pages(filter: PirschFilter): Promise; /** * conversionGoals returns all conversion goals. * * @param filter used to filter the result set. */ conversionGoals(filter: PirschFilter): Promise; /** * events returns all events. * * @param filter used to filter the result set. */ events(filter: PirschFilter): Promise; /** * eventMetadata returns the metadata for a single event. * The event name and metadata key must be set in the filter, or otherwise no results will be returned. * * @param filter used to filter the result set. */ eventMetadata(filter: PirschFilter): Promise; /** * listEvents returns a list of all events including metadata. * * @param filter used to filter the result set. */ listEvents(filter: PirschFilter): Promise; /** * eventPages returns all pages an event has been triggered on. * The event name must be set in the filter, or otherwise no results will be returned. * * @param filter used to filter the result set. */ eventPages(filter: PirschFilter): Promise; /** * growth returns the growth rates for visitors, bounces, ... * * @param filter used to filter the result set. */ growth(filter: PirschFilter): Promise; /** * activeVisitors returns the active visitors and what pages they're on. * * @param filter used to filter the result set. */ activeVisitors(filter: PirschFilter): Promise; /** * timeOfDay returns the number of unique visitors grouped by time of day. * * @param filter used to filter the result set. */ timeOfDay(filter: PirschFilter): Promise; /** * languages returns language statistics. * * @param filter used to filter the result set. */ languages(filter: PirschFilter): Promise; /** * referrer returns referrer statistics. * * @param filter used to filter the result set. */ referrer(filter: PirschFilter): Promise; /** * os returns operating system statistics. * * @param filter used to filter the result set. */ os(filter: PirschFilter): Promise; /** * osVersions returns operating system version statistics. * * @param filter used to filter the result set. */ osVersions(filter: PirschFilter): Promise; /** * browser returns browser statistics. * * @param filter used to filter the result set. */ browser(filter: PirschFilter): Promise; /** * browserVersions returns browser version statistics. * * @param filter used to filter the result set. */ browserVersions(filter: PirschFilter): Promise; /** * country returns country statistics. * * @param filter used to filter the result set. */ country(filter: PirschFilter): Promise; /** * region returns regional statistics. * * @param filter used to filter the result set. */ region(filter: PirschFilter): Promise; /** * city returns city statistics. * * @param filter used to filter the result set. */ city(filter: PirschFilter): Promise; /** * platform returns the platforms used by visitors. * * @param filter used to filter the result set. */ platform(filter: PirschFilter): Promise; /** * screen returns the screen classes used by visitors. * * @param filter used to filter the result set. */ screen(filter: PirschFilter): Promise; /** * screen returns the screen classes used by visitors. * * @param filter used to filter the result set. */ tagKeys(filter: PirschFilter): Promise; /** * screen returns the screen classes used by visitors. * * @param filter used to filter the result set. */ tags(filter: PirschFilter): Promise; /** * keywords returns the Google keywords, rank, and CTR. * * @param filter used to filter the result set. */ keywords(filter: PirschFilter): Promise; /** * listFunnel returns a list of all funnels including step definition for given domain ID. * * @param filter used to filter the result set. */ listFunnel(filter: PirschFilter): Promise; /** * funnel returns a list of all funnels including step definition for given domain ID. * * @param filter used to filter the result set. Then funnel_id must be set. */ funnel(filter: PirschFilter): Promise; private performPost; private performGet; private performFilteredGet; private getFilterParams; private refreshToken; private generateUrl; private accessModeCheck; protected abstract post(url: string, data: Data, options?: PirschHttpOptions): Promise; protected abstract get(url: string, options?: PirschHttpOptions): Promise; protected abstract toApiError(error: unknown): Promise; }