Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Content Groups on PV event #188

donohoe opened this issue Dec 17, 2019 · 3 comments

Add support for Content Groups on PV event #188

donohoe opened this issue Dec 17, 2019 · 3 comments


Copy link

@donohoe donohoe commented Dec 17, 2019

A standard feature for publishers (big and small) is having "custom groups". Typically this is allowing them to provide key-value pairs (that they define but intended to describe page-hierarchy and content types) that are sent along with the Page View event.

Services like Chartbeat, Parsely, and Google Analytics handle them and you can learn more about them:

Example in the wild:

  1. On Google Chrome (as an example)
  2. Open Developer Tools and choose Network Tab, and choose "JS" tab:
  3. Go to this NYTimes url: Link (you could randomly try any other (US) media site and likely do this too...)
  4. Filter with term "google-analytic"
  5. Click on the first item beginning with "collect?v=1&"
  6. Browse through the list and examine the ones that have "t=pageview" in the URL
  7. In Headers, look at the "Query String Parameters"


GA documentation: Content Group

"You can have up to 5 content groupings, each of which has an associated index between 1 and 5, inclusive. Each content grouping can have up to 100 content groups. The value of a content group is hierarchical text delimited by '/".

In the New York Times case they are using "Content Groups" to establish hierarchy of the article that the reader visited.

cg1: us (Section)
cg2: politics (Sub-Section)
cg3: article (Content Type: article, slideshow, interactive, etc.)
cg4: news (Group: news, opinion, etc)

Using these they can gather insights via simple reports that show PVs, Uniques, etc against these items. It helps answer and inform on numerous question such as (just examples):

  • What is the most popular sub-section across the site, or within a given section?
  • What sections have the most popular articles?
  • Traffic based on content type?

I reiterate that this is a basic and required feature for any publishers (I have worked for several and state this from experience) and would benefit non-publishers too.

I believe that is possible to do this without adding risk of adding invasive tracking - or even by adding all the options that GA allows. The purpose of this is to provide overview information and nothing specific to any one reader.

Potential ways to implement:

1. JSON-LD Tag
Parsely uses this standard:
Not my favorite approach but you could extend this to add a JSON Literal and pass it as a blob of data...

2. Custom META tag
Use a META tag with a specific name attribute, and provide key-value pairs in a delimited text string.

<meta name="content-groups" content="cg1:us;cg2:politics;cg3:article;cg4:news" />

This relies on JS to to look for META tag, and if found, pass on the information.

var m = document.querySelector("meta[name='content-groups']") || false;
if (m) {
	var v = m.getAttribute("content") || false;
	if (v) {
		console.log("Send content groups", v);

This comment has been minimized.

Copy link

@adriaanvanrossum adriaanvanrossum commented Dec 17, 2019

Thanks a lot, that looks great. Wonder how custom dimensions are different. But for now it seems like the content groups are not privacy invasive. As long as it can not be used for anything privacy invasive I'm happy to implement a (simple) version.


This comment has been minimized.

Copy link

@donohoe donohoe commented Feb 12, 2020

Let me know if I can assist further.


This comment has been minimized.

Copy link

@adriaanvanrossum adriaanvanrossum commented Feb 12, 2020

We will be updating our back end this summer to allow for more params with page views. When we do this we will take this feature in mind! By then I might ask you some more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Public roadmap
Features & bugs
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.