further-external / brookings-datalayer-specs

An Apollo generated Event Driven Data Layer
0 stars 1 forks source link

Page Load Started #8

Open nedierecel opened 1 year ago

nedierecel commented 1 year ago

Page Load Started

Javascript Code

window.dataLayer = window.dataLayer || [];
dataLayer.push({ event_data: null });  // Clear the previous event_data object.
dataLayer.push({ page_data: null });  // Clear the previous page_data object.
dataLayer.push({
  "event": "page_load_started",
  "detailed_event": "Page Load Started",
    "event_data": {
        "archived": <archived>,
        "author": "<author>",
        "author_id": "<author_id>",
        "author_type": "<author_type>",
        "center": "<center>",
        "chart_id": "<chart_id>",
        "content_type": "<content_type>",
        "email_subscribers": <email_subscribers>,
        "format": "<format>",
        "historical_url": "<historical_url>",
        "interactive": <interactive>,
        "original_post_id": "<original_post_id>",
        "parent": "<parent>",
        "post_id": "<post_id>",
        "primary_topic": "<primary_topic>",
        "program": "<program>",
        "project": "<project>",
        "publish_date": "<publish_date>",
        "region": "<region>",
        "subtype": "<subtype>",
        "tag_id": "<tag_id>",
        "tags": "<tags>",
        "template": "<template>",
        "topic": "<topic>",
        "type": "<type>",
        "word_count": "<word_count>"
    },
    "page_data": {
        "language": "<language>",
        "name": "<name>",
        "page_location": "<page_location>"
    }
});

Variable Definitions

Path Type Description Example Pattern Min Length Max Length Minimum Maximum Multiple Of
event_data.archived boolean Whether the content has been archived Yes, No
event_data.author string The expert(s) who have created the content; can include a comma separated list of authors Sandra Rozo, Hernan Winkler
event_data.author_id string ID for distinct author in Wordpress
event_data.author_type string Describes the type of author Guest Author, Expert, Leadership
event_data.center string Collection of topics and fellows organized under a program The Katzmann Initiative
event_data.chart_id string From Data Wrapper
event_data.content_type string Captures the content category like post, essay, or research post
event_data.email_subscribers integer Boolean value to segment users who have subscribed to a newsletter yes
event_data.format string Post type Page, Landing Page, Article, Event, Collection, Book and News
event_data.historical_url string URL of post from historical site \/research\/what-caused-the-u-s-pandemic-era-inflation\/
event_data.interactive boolean Whether it is interactive content Yes, No
event_data.original_post_id string Original Post ID from historical site 20619
event_data.parent string "Parent" dropdown in the Post Options panel of the Wordpress Editor UI Events, Experts, Home
event_data.post_id string Unique content identifier 617631
event_data.primary_topic string Primary value selected in the CMS Global Economy
event_data.program string Captures the research program for the content Global Economy and Development
event_data.project string Initiatives tied to a research program Brookings Economic and Social Policy in Latin America Initiative
event_data.publish_date string Date the content was published. 2019-10-11
event_data.region string Geo Africa, Asia & the Pacific
event_data.subtype string Subtype of post Op-ed, Podcast, Testimony
event_data.tag_id string ID for distinct tag in Wordpress
event_data.tags string From Wordpress Post Editor under the "Tags" dropdown within the format dialogue. Covers "Series", "Blog". 17 Rooms Podcast, Africa in Focus
event_data.template string Template type in Wordpress Research & Commentary Landing
event_data.topic string List of comma separated themes that can be shared between programs Colombia, Global Economy
event_data.type string Type of post Commentary, Research
event_data.word_count string Total word count for content 389
page_data.country string The country associated with the current page. US, CA, FR, UK
page_data.language string The language of the current page, usually pulled from the <html> tag lang attribute. en-us, en-gb, ch-cn, fr-ca, fr-fr
page_data.name string Captures the name of the page the user is on product - XYZ123, Mens - Tops - Sweaters, Order Confirmation
page_data.page_location string The URL of the page currently being viewed. This value will include the full, unaltered URL of the page\/screen the user is currently viewing, including query parameters, fragments, etc., for example https:\/\/www.example.com\/home?user=true&audience=test#aboutus. https:\/\/www.example.com\/home?user=true&audience=test#aboutus
jerry-bennett commented 1 year ago

Tested on: https://preview.brookings.edu/articles/spurred-by-federal-legislation-new-industrial-investments-are-reaching-a-wide-swath-of-the-country/

Use case: Loaded page and checked the data layer specs

Status: Working. seeing all the values in the data layer push, however a decent amount of them are null or not populated at all. Not sure if that will be a problem or not in the future.

The tag seems to double fire inside of GTM preview mode. Once for a 'page_load_started' custom event, and once for the 'History Change' event. I'll update the trigger.

@jmoconn I understand that some of these null values might be expected, but wanted to get your approval before I move it to 'complete'

Image

Image

Image

Image

jmoconn commented 1 year ago

@jerry-bennett I think that's right -- it looks like the null variables are null because they are not applicable for this particular article. For example, 'project' is null because this article is not associated with any project. Here are two other example articles with data populating for some of the variables that are null here:

https://preview.brookings.edu/articles/a-nigerian-entrepreneur-shares-her-story-of-innovation-and-transformative-leadership/

https://preview.brookings.edu/articles/unpacking-the-chinese-readouts-of-blinkens-meetings-in-beijing/

jerry-bennett commented 1 year ago

@jmoconn Looks good to me! Loaded those examples and saw the values populating that were null in the original example. Moving this to 'complete' for now.

Image

jerry-bennett commented 1 year ago

PROD QA:

Tested on: https://www.brookings.edu/articles/techtank-podcast-episode-72-social-media-and-teens/

Use case: Loaded page

Status: Looks great, seeing both the GTM tag fire and the data layer push. Additionally, the tag only fires once now instead of twice.

Image

Image