Utility for tracking in Google Analytics

Hierarchy

  • GA

Constructors

Methods

Constructors

  • Returns GA

Methods

  • Initializes Google Analytics

    Compatibility Control

    • API LEVEL 1 - Functionality added

    Parameters

    • trackingId: string

      Project ID obtained through the Google Analytics control panel

    • timeout: number = 5000

      Optional timeout in milliseconds before initialization aborts; defaults to 5000 ms

      Example usage:

      Eitri.tracking.GA.init("G-00000").then(gtag => {
      gtag("event", "event_name", {
      "debug_mode": true,
      "page": "/MyPage"
      })
      }).catch(e => {
      console.log("Eitri.tracking.GA.init.error: ", e)
      });

      event - Type of hit being sent to GA

      debug_mode - Allows debugging this hit in GA

      page - Example of a custom parameter

    Returns Promise<any>

Generated using TypeDoc