Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Analytics

The Analytics class allows for sending events and metrics to Google Analytics with a given UA_STRING.

Hierarchy

  • Analytics

Index

Constructors

constructor

  • new Analytics(uaString: any, loadPromise: any): Analytics
  • Parameters

    • uaString: any
    • loadPromise: any

    Returns Analytics

Properties

gumshoe

gumshoe: any

loadPromise

loadPromise: Promise<any>

ready

ready: boolean

uaString

uaString: string

user

user: User

Methods

Private mapData

  • mapData(data: any): object
  • Internal function to map event data to GA format.

    Parameters

    • data: any

    Returns object

    • aid: string
    • an: string
    • cd1: any
    • cd2: any
    • cd3: any
    • cd4: any
    • cid: any
    • cm2: any
    • cm3: any
    • dh: any
    • dl: any
    • dp: any
    • dr: any
    • dt: any
    • ea: undefined
    • ec: undefined
    • el: undefined
    • ev: undefined
    • je: any
    • sr: any
    • t: string
    • tid: string
    • ua: any
    • uid: any
    • uip: string
    • ul: any
    • v: number
    • vp: string

pageView

  • pageView(): void
  • Sends a simple page view event to Google Analytics.

    Returns void

sendEvent

  • sendEvent(category: string, name: string, value?: any, label?: string): void
  • Sends an arbitrary even to Google Analytics.

    Parameters

    • category: string

      The high-level category to collect this event under.

    • name: string

      A unique identifier for this event.

    • Default value value: any = 1

      (optional) A value to associate with this event (defaults to 1).

    • Default value label: string = ""

      (optional) A human-readable label for this event.

    Returns void

Generated using TypeDoc