Last updated

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

OptionDescription
amplitudeIntegrates Amplitude Analytics into your developer portal. This integration is supported through the Gatsby Amplitude plugin. Refer to the official plugin documentation for more details.
fullstoryIntegrates FullStory analytics into your developer portal. When configured, this integration works only in production, not in local development mode.
gaIntegrates 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.
gtagIntegrates 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.
gtmIntegrates 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.
heapIntegrates Heap Analytics into your developer portal. This integration is supported through the Gatsby Heap plugin. Refer to the official plugin documentation for more details.
rudderstackIntegrates Rudderstack Analytics into your developer portal. This integration is supported through the Gatsby Rudderstack plugin. Refer to the official plugin documentation for more details.
segmentIntegrates Segment Analytics into your developer portal. This integration is supported through the Gatsby SegmentJS plugin. Refer to the official plugin documentation for more details.
Google Marketing PlatformIntegrates Google Optimize into your developer portal. This integration is supported through the Gatsby Google Marketing Platform plugin. Refer to the official plugin documentation for more details.

Examples

Amplitude

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

analytics:
  fullstory:
    fs_org: YOUR_ORG_ID

Google Analytics

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)

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

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

Heap Analytics

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

Rudderstack Analytics

analytics:
  rudderstack:
    prodKey: your-prod-write-key
    devKey: your-dev-write-key
    dataPlaneUrl: your-data-plane-url
    trackPage: true

Segment

analytics:
  segment:
    prodKey: SEGMENT_PRODUCTION_WRITE_KEY
    trackPage: true

Google Marketing Platform

analytics:
  googleOptimize:
    dataLayer:
      gaPropertyId: your-google-analytics-tracking-id
    optimize:
      id: your-google-optimize-tracking-id
    tagmanager:
      id: your-google-tag-manager-id
    analytics:
      trackingId: your-google-analytics-tracking-id