Skip to content

Event Data and Instrumentation

Kris Kenney edited this page Feb 16, 2022 · 2 revisions

Dev Site Event Data & Instrumentation

The event data and instrumentation approach for the Dev Site is similar to that of the Doc Site. There are several different ways to view this data to track site behavior and other site analytics. If you work for New Relic and have questions on how this data is used, where it's available in NR1 Dashboards or Amplitude or GA, please reach out the Developer Enablement help channel in Slack for assistance.

Tessen Events

Tessen is New Relic’s JavaScript library for tracking and distributing data about events within the New Relic One platform and external sites (such as newrelic.com or docs.newrelic.com) to third-party and database endpoints via the Segment.io API.

Event data

Theme events

The following events come from the theme, and are not specific to this site:

ActionName Action Trigger
TDEV_ErrorPage_error404 occurs when a specified URL is redirected to a 404 page
TDEV_GlobalSearch_swiftypeSearchInput occurs when a user inputs a search into the global search bar
TDEV_CreateIssue_createAnIssueClick occurs when the create issue button is clicked
TDEV_EditPage_editThisPageClick occurs when edit page button is clicked
TDEV_CodeBlock_copyCodeBlockClick occurs when the copy code block button is clicked
TDEV_LinkClick_InternalLinkClick occurs when user clicks on any internal link. When this link is a nav item it will include the navInteractionType attribute
TDEV_LinkClick_ExternalLinkClick occurs when user clicks on any internal link. When this link is a nav item it will include the navInteractionType attribute

In-site events

The following events are specific to the developer site:

ActionName Action Trigger
TDEV_DocPageView_pageView occurs when a dev page is viewed
TDEV_DocPageLinkClick_stitchedPathLinkClick occurs when a user clicks on a button deemed a "stitched path"
TDEV_PositiveFeedbackClick_feedbackThumbClick occurs when a user clicks on a positive feedback button
TDEV_NegativeFeedbackClick_feedbackThumbClick occurs when a user clicks on a negative feedback button

Tessen Instrumentation Example

The gatsby-theme-newrelic module includes a useTessen.

In the component you want to add a page action, simply import using:

import { useTessen } from '@newrelic/gatsby-theme-newrelic';

Within your components scope:

const CustomComponent = () => {
  const tessen = useTessen();

Then use the hooks track() function and set an eventName, actionName and attributes as required. You can perform this any callback function, for example onClick():

onClick={(e) => {
    tessen.track('eventName', `actionName`, {
        attribute1: e.target.value,
    });
}}

Debugging

To make sure Tessen is working correctly, you can alter the debug level either in your script or in your Browsers DevTools Console:

> window.Tessen.debugLevel(2)
tessen.min-1.3.0.js:202 Set debug level to 2 (verbose)
< 2

When you perform actions instrumented by Tessen, they should now log to the console.

Google Analytics

When a user has not agreed to cookie consent (either by selecting No or not selecting anything), Google Analytics is used to anonymously track basic analytics like page views, sessions, etc. If a user has agreed to cookie consent, Tessen data is forwarded from Segment to the same Google Analytics account.

Event data

Google Analytics is used for general site analytics e.g. sessions, page views, etc as well as tracks several event actions. Any Tessen event data is also sent to Google Analytics.

In addition to Tessen event data, Google Analytics event data also includes:

Category Action Trigger
cookie_consent occurs when a user selects No in cookie consent dialog. The event action is named opt_out.

Additional Properties

Name Definition
path the path requested for that url
searchTerm search input
totalResults count of the number of results from the swiftype search
href full href value for either external links
title title of page
component component where this action is taking place
feedback "positive" or "negative"
modified whether the code was modified or not in the codeblock
hash hash value attached to path
mode "dark" or "light"

Tracking Country specific sites

The Docs Site stores localized country specific files found in the i18n directory. These files make up the site content for a language specific version of the Docs Site.

To track the traffic to these pages you can do the Following in GA.

  1. Click on + Add Segment
  2. Select NEW Segment
  3. Set your Conditions
  4. Select all Pages for docs/{country_code/

Testing Locally

New Relic Browser monitoring is instrumented using the gatsby-plugin-newrelic. The only requirement to test Tessen is that the GATSBY_NEWRELIC_ENV is set to match one of the configuration options in gatsby-config.js.

For the dev site, you can use the following command:

GATSBY_NEWRELIC_ENV=staging yarn develop