Google Analytics

How to setup and use GoogleAnalytics to track key events across your guides experience.

Overview

The following guide will outline the steps required to set up google analytics for use with Different Breed.

1. Create A Tracking Source Within Different Breed

You can find the location to define measurement tracking on Different Breed by accesing the following from your guides landing page: Metrics > Tracking. Once loaded, click Create Source, select Google Analytics or Google Adwords as the provider and follow the next steps.

2. Create a Google Analytics 4 property.

Different Breed is unable to assist with setting up your Google Analytics property. If you need help with this step, follow these steps from Google’s Help Center.

3. Copy your measurement ID.

For websites, a Measurement ID can be used to send data to your Google Analytics 4 property through an associated web data stream (similar to a Tracking ID in Universal Analytics properties). Find your Measurement ID in Admin > Data Streams.

Once found, past the value into the "Measurement ID" field.

NOTE: If you’re still using Universal Google Analytics, you will need to upgrade to Google Analytics v4 to enable tracking on Different Breed.

4. Create your measurement protocol secret

To create a new secret, navigate in the Google Analytics UI to: Admin > Data Streams > choose your stream > Measurement Protocol > Create

Once created copy the secret value and paste it into the "Measurement Secret" field.

5. Select Events To Track

On the Different Breed Tracking source form you are presented with a number of events and page views you can track. While the majority of these are standard events and do not require additional set up, a few will require custom events to be created to get the most of our your reports.

Standard Events

Event NameGA4 EventDescription

Page View

page_view

Tracks a customer landing on a desired page during the guides experience.

Custom Events

To create a new custom event, navigate in the Google Analytics UI to: Admin > Data Streams > choose your stream > Measurement Protocol > Create

Event NameGA4 EventMatching ConditionDescription

Campaign

campaign

Parameter event_name equals campaign

Tracks a traditional UTM style campaign.

Filters Applied

guide_filters_applied

Parameter event_name equals guide_filters_applied

Tracks when a user applies filters to the guide.

Share Clicked

guide_share_clicked

Parameter event_name equals guide_share_clicked

Tracks when a user clicks to share the guide.

Print Clicked

guide_print_clicked

Parameter event_name equals guide_print_clicked

Tracks when a user clicks to print the guide.

Feedback Initiated

guide_feedback_initiated

Parameter event_name equals guide_feedback_initiated

Tracks when a user clicks to provide feedback.

Feedback Submitted

guide_feedback_submitted

Parameter event_name equals gudie_feedback_submitted

Tracks when a user clicks to submit feedback.

6. Save Your Tracking Source

Once you have selected your desired events, simply save the source and the tracking events will begin to fire.


Test Your Tracking Source

To test your tracking pixel, Simply view the Real Time Reporting view within your Google Analytics UI. Once you have the real time reporting view loaded, navigate your guide and trigger the enabled events to see them appear in the UI.


Breakdown Of Events We Send

User Data

All the events we send will contain the following user data.

Payload Sent
type GA4UserData = {
  user_agent: string;
  client_ip: string;
  client_id: string;
  gclid: string;
  engagement_time_msec: number;
};
FieldTypeDescription

user_agent

string

The User-Agent string of the user's browser, which provides information about the browser type, version, and operating system.

client_ip

string

The IP address of the client making the request, used to identify the geographic location of the user.

client_id

string (uuid)

A unique identifier for the client, typically generated by the client to uniquely identify a user or device across sessions.

gclid

string

The Google Click Identifier, a parameter used by Google Ads to track ad clicks and conversions.

For the purpose of having the active users logged, we set engagement_time_msec to 1 in every tracking event we send.

Event Structure

All the events we send to Google Analytics contain the following structure and properties:

FieldTypeDescription

client_id

string (uuid)

A unique identifier for the client, typically generated by the client to uniquely identify a user or device across sessions.

events

Array

An array of tracking events to be processed.

page_title

string

The title of the page sending the event.

page_location

string

The url of the page sending the event.

db_guide_id

string

The id of the guide you have created within Different Breed.

Page View

Tracks a customer landing on a desired page during the guides experience. The following pages are supported:

  • Guide Filters

  • Guide Content

For each page view you enable we will send the following data structure to Google Analytics:

Payload Sent
export type GA4PageViewPayload = {
  client_id: string;
  events: {
    name: 'page_view';
    params: GA4UserData & {
      page_location: string;
      page_title: string;
      db_guide_id: string;
    };
  }[];
};
FieldTypeDescription

page_location

string

The url of the page sending the event.

page_title

string

The title of the page sending the event.

db_guide_id

string (uuid)

The id of the guide your have created within Different Breed.

Campaign

Tracks a traditional utm style campaign. To track this effectively your URL parameters should be formatted in the following way:

?utm_source=hubspot&utm_medium=email&utm_campaign=spring_sale&utm_id=campID&utm_term=term1%2C+term2&utm_content=content_xyz

Google have a useful tool to help with this: https://ga-dev-tools.google/ga4/campaign-url-builder/

This will enable us to send the following data structure to Google Analytics:

Payload Sent
export type CampaignData = {
  campaign_id: string;
  campaign: string | null;
  source: string | null;
  medium: string | null;
  term: string | null;
  content: string | null;
};

export type GA4CampaignPayload = {
  client_id: string;
  events: {
    name: 'campaign';
    params: GA4UserData &
      CampaignData & {
        page_location: string;
        page_title: string;
        db_guide_id: string;
      };
  }[];
};
FieldTypeDescription

campaign_id

string

The provided campaign id from the url.

campaign

string

The provided campaign from the url.

source

string

The provided source from the url.

medium

string

The provided medium from the url.

term

string

The provided term from the url.

content

string

The provided content from the url.

Filters Applied

Tracks when a user applies filters to the guide.

Payload Sent
export type GA4FiltersAppliedPayload = {
  client_id: string;
  events: {
    name: 'guide_filters_applied';
    params: GA4UserData & {
      ticket_puchased: boolean;
      visual_impairments: boolean;
      hearing_impairments: boolean;
      mobility_physical_disabilities: boolean;
      chronic_illnesses_fatigue: boolean;
      mental_health_emotional: boolean;
      speech_communication: boolean;
      neurodivergent_sensory: boolean;
      cognitive_disabilities: boolean;
      page_location: string;
      page_title: string;
      db_guide_id: string;
    };
  }[];
};
FieldTypeDescription

ticket_puchased

boolean

Indicates if the user has purchased a ticket.

visual_impairments

boolean

Indicates the user has filtered for visual impairments.

hearing_impairments

boolean

Indicates the user has filtered for hearing impairments.

mobility_physical_disabilities

boolean

Indicates the user has filtered for mobility impairments.

chronic_illnesses_fatigue

boolean

Indicates the user has filtered for chronic illness needs.

mental_health_emotional

boolean

Indicates the user has filtered for mental health needs.

speech_communication

boolean

Indicates the user has filtered for speech impairments.

neurodivergent_sensory

boolean

Indicates the user has filtered for neurodiverse needs.

cognitive_disabilities

boolean

Indicates the user has filtered for cognative disabilities.

Share Clicked

Tracks when a user clicks to share the guide.

Payload Sent
export type GA4GuideShareClickedPayload = {
  client_id: string;
  events: {
    name: 'guide_share_clicked';
    params: GA4UserData & {
      page_location: string;
      page_title: string;
      db_guide_id: string;
    };
  }[];
};

Send the Event Structure only.

Tracks when a user clicks to print the guide.

Payload Sent
export type GA4GuidePrintClickedPayload = {
  client_id: string;
  events: {
    name: 'guide_share_clicked';
    params: GA4UserData & {
      page_location: string;
      page_title: string;
      db_guide_id: string;
    };
  }[];
};

Send the Event Structure only.

Feedback Initiated

Tracks when a user clicks to provide feedback on the guide.

Payload Sent
export type GA4GuideFeedbackInitiatedPayload = {
  client_id: string;
  events: {
    name: 'guide_share_clicked';
    params: GA4UserData & {
      page_location: string;
      page_title: string;
      db_guide_id: string;
    };
  }[];
};

Send the Event Structure only.

Feedback Submitted

Tracks when a user clicks to submit feedback on the guide.

Payload Sent
export type GA4GuideFeedbackSubmittedPayload = {
  client_id: string;
  events: {
    name: 'guide_share_clicked';
    params: GA4UserData & {
      page_location: string;
      page_title: string;
      db_guide_id: string;
    };
  }[];
};

Send the Event Structure only.

Last updated