analytics

Usage

Use the analytics section to integrate popular web analytics solutions into your portal.

Add it to the top level of the siteConfig.yaml file and configure supported analytics integrations inside it.

Options

Option Description
amplitude Integrates Amplitude Analytics into your developer portal. This integration is supported through the Gatsby Amplitude plugin. Refer to the official plugin documentation for more details.
fullstory Integrates FullStory analytics into your developer portal. When configured, this integration works only in production, not in local development mode.
ga Integrates Google Analytics into your developer portal. This integration is supported through the Gatsby Google Analytics plugin. Refer to the official plugin documentation for more details.
gtag Integrates Google Global Site Tag into your developer portal. When configured, this integration works only in production, not in local development mode. This integration is supported through the Gatsby google-gtag plugin. Refer to the official plugin documentation for more details.
gtm Integrates Google Tag Manager into your developer portal. This integration is supported through the Gatsby Google Tag Manager plugin. Refer to the official plugin documentation for more details.
heap Integrates Heap Analytics into your developer portal. This integration is supported through the Gatsby Heap plugin. Refer to the official plugin documentation for more details.
segment Integrates Segment Analytics into your developer portal. This integration is supported through the Gatsby SegmentJS plugin. Refer to the official plugin documentation for more details.

Examples

Amplitude

Copy
Copied
analytics:
  amplitude:
    apiKey: your-api-key
    head: false
    respectDNT: true
    exclude:
      - /preview/**
      - /do-not-track/me/too/
    eventTypes:
      outboundLinkClick: OUTBOUND_LINK_CLICK
      pageView: PAGE_VIEW
    amplitudeConfig:
      saveEvents: true
      includeUtm: true
      includeReferrer: true
    environments:
      - production

FullStory

Copy
Copied
analytics:
  fullstory:
    fs_org: YOUR_ORG_ID

Google Analytics

Copy
Copied
analytics:
  ga:
    # This option places the tracking script into the ”<head>” of your website
    # If set to false (default), the script is placed into the "<body>"
    head: true
    trackingId: your-google-analytics-tracking-id

Google Global Site Tag (gtag.js)

Copy
Copied
analytics:
  gtag:
    trackingIds:
      - "GA-TRACKING_ID" #Google Analytics / GA
      - "AW-CONVERSION_ID" #Google Ads / Adwords / AW
      - "DC-FLOODIGHT_ID" # Marketing Platform advertising products (Display & Video 360, Search Ads 360, and Campaign Manager)
    # This object gets passed directly to the gtag config command
    # This config will be shared across all trackingIds
    gtagConfig:
      optimize_id: "OPT_CONTAINER_ID"
      anonymize_ip: true
      cookie_expires: 0
    # This object is used for configuration specific to this plugin
    pluginConfig:
      # Puts tracking script in the head instead of the body
      head: false
      # Setting this parameter is also optional
      respectDNT: true
      # Avoids sending pageview hits from custom paths
      exclude: ["/preview/**", "/do-not-track/me/too/"]

Google Tag Manager

Copy
Copied
analytics:
  gtm:
    id: your-google-tag-manager-id

Heap Analytics

Copy
Copied
analytics:
  heap:
    appId: your-app-id
    enableOnDevMode: true # set to false by default

Segment

Copy
Copied
analytics:
  segment:
    prodKey: SEGMENT_PRODUCTION_WRITE_KEY
    trackPage: true