Javascript API

JavaScript API

Setup and Pass Page-Level Key-Value Pairs

You can pass custom page-level key-value (KV) data into Pubperf using the following API pattern:

window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: 'pubperf.data',
  KEY_NAME: VALUES,
});

Supported Keys

The following KEY_NAME fields are supported:

  • author(String) Author of the content
  • category(String) Category or section of the page
  • keywords(Array of Strings) Related keywords or tags

Example Usage

window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: 'pubperf.data',
  keywords: ['Sports', 'Features', 'News'],
  author: 'Alex Stead',
  category: 'News',
});

What Happens Next?

Once set, these custom fields will enrich your analysis data. You’ll be able to filter and segment your metrics using these dimensions in addition to the page URL to gain deeper insights into performance by author, category, and keywords.