View difference between Paste ID: BXFwZhpq and 1tZvAqPB
SHOW: | | - or go back to the newest paste.
1-
// Fire this dataLayer event when a successful submission of the newsletter sign-up form occurs. The event should fire only for successful submissions. The event shouldn't fire again if the user reloads or revisits the thank-you page.
1+
// Fire this dataLayer event on every page load, before the Google Tag Manager base script loads.
2
3
<script>
4
window.dataLayer = window.dataLayer || [];
5
window.dataLayer.push({
6-
 'event': 'newsletter_sign_up',
6+
 'event': 'page_info',
7-
 'formLocation': 'pop_up',  // Variable value - the location of the form on the page, e.g. footer, body, pop_up
7+
 'pageType': 'article',  // Variable value based on the type of the page, e.g. article, course, author, podcast, contact, other, etc.
8-
 'timeOnSite': '5-10min',  // Time user spent on the site (across all of their sessions) before subscribing. Categorized into 5-minute ranges.
8+
 'articleCategory': 'design',  // Variable value - based on article category, e.g. design, marketing, video, etc. Include only for article pages.
9-
 'popUpShows': '2'  // Specifies which time they subscribed: the first time the pop-up shows, the second time (>24h after the first pop-up), or the third time (>2weeks later). Include only for pop-up subscriptions.
9+
 'articleFeaturedCategory': 'design',  // Variable value - based on article featured category, e.g. design, marketing, video, etc. Include only for article pages.
10
 'estimatedCompletionTime': '00:06:00', // Estimated time needed to completely read-listen-watch an article-podcast-masterclass. Only include on individual content piece pages. The format is hh:mm:ss
11
 'estimatedCompletionTimeMsec': '360000', // Estimated time needed to completely read the article in milliseconds. Just transfer the value from the parameter above this one to milliseconds. E.g. 00:06:00 to 360000. Only include on article pages. 
12
 'contributorName': 'John Smith',  // Name of the contributor. Only include on article pages, author pages, and course pages.
13
 'courseName': 'How to develop your brand',  // Name of the course. Only include on course pages.
14
 'courseCategory': 'Brand development',  // Category of the course. Only include on course pages.
15
 'courseTier': 'paid',  // Paid, free, or premium. Only include on course pages.
16
 'courseLengthGroup': '0-5h',  // 0-5h, 6-10h, 11-15h, 16-20h, 21-30h, 30h+. Only include on course pages.
17
 'courseValue': 3000,  // Course value in USD. Should be a number. Only include on course pages.
18
 'userStatus': 'logged-in',  // Variable value - logged-in if visitor is logged in, not-logged-in if visitor is not logged in.
19
 'userId': '12343665',  // User ID from the database.
20
 'publishedDate': '30 JUN 2022',  // Date when the article was published. Include this parameter only on article pages.
21
 'publishedMonth': 'JUN',  // Month when the article was published. Include this parameter only on article pages.
22
 'publishedYear': '2022'  // Year when the article was published. Include this parameter only on article pages.
23
 });
24
</script>