npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@atlaskit/ufo-experience-key

v0.2.0

Published

Utility for generating UFO experience key headers for GraphQL and HTTP requests across AFM

Readme

UFO Experience Key

Utility for generating UFO experience key headers for GraphQL and HTTP requests across Atlassian Frontend Monorepo (AFM).

Purpose

This package provides utilities to capture and generate experience key headers for GraphQL and HTTP requests. Experience keys represent feature names registered in Glance (formerly PerfPortal) and are used to track which frontend features initiated requests.

Installation

npm install @atlaskit/ufo-experience-key

Exports

PRODUCT_NAMES

Constants for product names to ensure consistency across the codebase.

import { PRODUCT_NAMES } from '@atlaskit/ufo-experience-key';

export const PRODUCT_NAMES = {
	JIRA: 'jira',
	CONFLUENCE: 'confluence',
	MERCURY: 'mercury',
	SOFTWARE: 'software',
	SERVICE_DESK: 'serviceDesk',
	CORE: 'core',
	PRODUCT_DISCOVERY: 'product-discovery',
	CUSTOMER_SERVICE: 'customer-service',
} as const;

getUfoExperienceKey(product: string): string

Builds the UFO experience key in the format: product.fe.loadType.featureName

Parameters:

  • product (string): The product name - use PRODUCT_NAMES constants for type safety

Returns: Experience key string (always returns a value, never undefined)

Example:

import { getUfoExperienceKey, PRODUCT_NAMES } from '@atlaskit/ufo-experience-key';

const key = getUfoExperienceKey(PRODUCT_NAMES.JIRA);
// Returns: "jira.fe.page-load.issueView" (if active interaction exists)
// Returns: "jira.fe.feature-type-absent.feature-name-absent" (if no active interaction)

getUfoExperienceKeyHeader(product: string)

Returns the header object to be included in GraphQL/HTTP requests.

Parameters:

  • product (string): The product name - use PRODUCT_NAMES constants for type safety

Returns:

  • When active interaction exists: { 'atl-paas-cnsmr-ctx-experience-key': string }
  • When no active interaction: { 'atl-paas-missing-experience-key-product': string }

Always returns a value object, never undefined or null.

Example:

import { getUfoExperienceKeyHeader, PRODUCT_NAMES } from '@atlaskit/ufo-experience-key';

// In GraphQL middleware/headers layer
const headers = {
	'Content-Type': 'application/json',
	...getUfoExperienceKeyHeader(PRODUCT_NAMES.JIRA),
	// ... other headers
};

// With active interaction:
// {
//   'atl-paas-cnsmr-ctx-experience-key': 'jira.fe.page-load.issueView'
// }

// Without active interaction:
// {
//   'atl-paas-missing-experience-key-product': 'jira'
// }

mergeUfoExperienceKeyHeaders(product: string, existingHeaders?: Record<string, string>)

Convenience utility for merging UFO experience key headers into an existing headers object. Useful for code that constructs headers manually (e.g., raw fetch() calls).

Parameters:

  • product (string): The product name - use PRODUCT_NAMES constants for type safety
  • existingHeaders (optional): Existing headers to merge with

Returns: Headers object with UFO experience key headers merged in

Example:

import { mergeUfoExperienceKeyHeaders, PRODUCT_NAMES } from '@atlaskit/ufo-experience-key';

const headers = mergeUfoExperienceKeyHeaders(PRODUCT_NAMES.JIRA, {
	'Content-Type': 'application/json',
	'Authorization': 'Bearer token'
});

fetch('/gateway/api/graphql', {
	method: 'POST',
	headers,
	body: JSON.stringify(...)
});

Constants

The following constants are exported for use in type definitions and code:

EXPERIENCE_KEY_HEADER_NAME

Header name used when an active interaction exists.

import { EXPERIENCE_KEY_HEADER_NAME } from '@atlaskit/ufo-experience-key';
// Value: 'atl-paas-cnsmr-ctx-experience-key'

MISSING_EXPERIENCE_KEY_HEADER_NAME

Header name used when no active interaction exists.

import { MISSING_EXPERIENCE_KEY_HEADER_NAME } from '@atlaskit/ufo-experience-key';
// Value: 'atl-paas-missing-experience-key-product'

Experience Key Format

With Active Interaction

Format: product.fe.loadType.featureName

Example: jira.fe.page-load.issueView

Without Active Interaction

Format: product.fe.feature-type-absent.feature-name-absent

Example: jira.fe.feature-type-absent.feature-name-absent

Load Type Mapping

UFO interaction types are mapped to load types as follows:

| Interaction Type | Load Type | | ---------------- | ------------------- | | page_load | page-load | | transition | page-load | | segment | page-segment-load | | Other/undefined | inline-result |

Architecture & Design Principles

This utility is designed to be called from centralized middleware/headers layers (e.g., Relay fetch layer, HTTP fetch layer) rather than at individual component/hook call sites.

Benefits:

  • Single source of truth for experience key generation
  • Automatic application to all requests from a single location
  • Simplified maintenance and updates across all products
  • No performance overhead from repeated calls
  • Clear separation of concerns - infrastructure layer handles header injection

Design:

  • Pure functions with no side effects
  • Constants extracted for maintainability (EXPERIENCE_KEY_HEADER_NAME, MISSING_EXPERIENCE_KEY_HEADER_NAME)
  • Helper functions for clarity (buildActiveExperienceKey, buildAbsentExperienceKey, deriveLoadType)
  • Always returns a value - no undefined/null returns
  • Optional chaining for safe null checks

Usage in Different Products

Jira

import { getUfoExperienceKeyHeader, PRODUCT_NAMES } from '@atlaskit/ufo-experience-key';

// In jira/src/packages/platform/fetch/src/utils/observability-headers.tsx
const experienceKeyHeader = getUfoExperienceKeyHeader(PRODUCT_NAMES.JIRA);

Confluence

import { getUfoExperienceKeyHeader, PRODUCT_NAMES } from '@atlaskit/ufo-experience-key';

// In confluence/next/packages/graphql/src/createWrappedFetch.ts
const experienceKeyHeader = getUfoExperienceKeyHeader(PRODUCT_NAMES.CONFLUENCE);

Mercury

import { getUfoExperienceKeyHeader, PRODUCT_NAMES } from '@atlaskit/ufo-experience-key';

// In mercury/src/clients/apolloClient.ts
const experienceKeyHeader = getUfoExperienceKeyHeader(PRODUCT_NAMES.MERCURY);

Related