Prompt Library

Generate Data Layer Docs 3x Faster with AI Prompts

Tired of manually writing data layer specifications? Our curated collection of AI prompts helps you generate comprehensive, accurate documentation in a fraction of the time. From defining events to creating variable dictionaries, these prompts streamline your entire workflow, ensuring your analytics implementation is flawless from the start.

Add ChatBoost to ChromeSave these prompts into ChatBoost and reuse them with Alt+P.

Prompt Library (26)

26 PromptsFree

Define Core Data Layer Structure

Create a foundational data layer object structure including page, user, and site information.

Act as a senior analytics developer. Generate a standard data layer object structure in JSON format for a [WEBSITE_TYPE, e.g., e-commerce, content-focused blog]. Include keys for `page`, `user`, and `site` information. For `page`, include `pageName`, `pageType`, `pageCategory`, and `pageId`. For `user`, include `loginStatus`, `userId`, `userType`, and `emailHash`. For `site`, include `siteSection`, `environment`, and `clientName`.

Build a Data Layer Variable Dictionary

Generate a markdown table to serve as a dictionary for your data layer variables.

Construct a markdown table that serves as a comprehensive data layer variable dictionary for a [PROJECT_TYPE, e.g., SaaS application, retail website]. The columns should be: 'Variable Name', 'Data Type', 'Description', 'Example Value', 'Scope' (e.g., event, page, session, user), and 'GA4 Mapping'. Populate it with 7 common examples relevant to [PROJECT_TYPE], such as `page.pageName`, `user.userId`, `event`, `ecommerce.transaction_id`, `product.sku`, `user.segment`, and `product.variant`.

Detail 'page_view' Event Specification

Document a standard 'page_view' event, including all relevant page-level parameters.

Write a technical specification for a `page_view` data layer event. The spec should include the event name, trigger condition (on page load), and a list of required data layer variables that must be present, such as `page.pageName`, `page.pageType`, `user.loginStatus`, and `site.siteSection`. Provide a complete JSON example of the data layer push.

Document 'form_submission' Event for [FORM_TYPE]

Create a detailed specification for tracking form submissions with dynamic form data.

Generate a data layer specification for a `form_submission` event for a [SPECIFIC_FORM_TYPE, e.g., lead generation, contact us, subscription] form. The event should include the following parameters: `form_id`, `form_name`, `form_destination_url`, `form_status` (e.g., 'success', 'error'), and `form_type` (e.g., 'lead', 'contact', 'newsletter'). Provide an example `dataLayer.push()` call for a '[FORM_NAME]' form.

Specify GA4 'add_to_cart' Event

Generate the GA4-compliant data layer specification for an 'add_to_cart' event.

Act as a Google Analytics expert. Create the complete data layer specification for a GA4 `add_to_cart` event. The spec must include the `ecommerce` object with an `items` array. Each item in the array should have the following keys: `item_id`, `item_name`, `price`, `quantity`, `item_category`, and `item_brand`. Provide a full `dataLayer.push()` example for adding two different products to the cart.

Detail GA4 'purchase' Event Specification

Create a comprehensive data layer spec for a GA4 'purchase' event, including all required parameters.

Write a detailed technical specification for a GA4-compliant `purchase` event. The data layer push must include `transaction_id`, `affiliation`, `value`, `tax`, `shipping`, `currency`, and an `items` array. For each item in the array, include `item_id`, `item_name`, `price`, and `quantity`. Provide a complete JSON example.

Document 'video_engagement' Event for [PLATFORM]

Specify a data layer event to track user interactions with an embedded video player.

Generate a data layer specification for a `video_engagement` event for a [VIDEO_PLATFORM, e.g., YouTube embedded, custom HTML5 player]. The event should track key video interactions. Include parameters for `video_action` (e.g., 'play', 'pause', 'progress', 'complete'), `video_title`, `video_id`, `video_provider` (e.g., 'YouTube', 'Vimeo'), `video_duration`, and `video_percent_viewed`. Provide separate `dataLayer.push()` examples for a 'play' action and a 'progress' action at 50% for a video titled '[VIDEO_TITLE]'.

Data Layer QA Checklist for Developers

Create a quality assurance checklist for developers to validate the data layer implementation.

Create a comprehensive QA checklist in markdown format for a developer to validate a data layer implementation for a [WEBSITE_OR_APP_TYPE, e.g., e-commerce site, mobile app]. Include checks for: data layer object initialization before the GTM container script, correct variable data types, event timing (e.g., form submission event fires on success), absence of PII, cross-browser compatibility, and validation against the official specification document. Add a section on using browser developer tools and GTM Debugger to monitor `dataLayer`.

Explain Data Layer to Non-Technical Audience

Write a simple, non-technical explanation of what a data layer is and why it's important.

Explain the concept of a data layer to a non-technical [STAKEHOLDER_ROLE, e.g., marketing manager, product owner]. Use an analogy to describe its function. Emphasize why a well-structured data layer is crucial for accurate marketing analytics, personalization, and A/B testing without getting into technical jargon. Focus on the benefits for their specific role.

Specify 'outbound_link_click' Event

Document an event to track when users click on links leading to external domains.

Create a data layer specification for an `outbound_link_click` event. The event should include the parameters `link_url`, `link_text`, and `link_domain`. Provide an example `dataLayer.push()` for a click on a link to 'https://www.example.com'.

GTM Custom JS for Nested Data Layer Variable

Write a GTM Custom JavaScript variable to safely access a nested value in the data layer.

Write a Google Tag Manager Custom JavaScript variable that safely retrieves the value of `[NESTED_VARIABLE_PATH, e.g., ecommerce.purchase.transaction_id, user.preferences.theme]` from the data layer. The script should handle cases where intermediate objects in the path are undefined to prevent errors, returning `undefined` or a default value (e.g., `null`, `false`) in those cases.

Specify 'user_login' Event for [AUTH_METHOD]

Create a specification for an event that fires upon successful user login.

Generate a data layer specification for a `user_login` event. The event should include a `method` parameter (e.g., 'email', 'google', 'facebook', '[YOUR_CUSTOM_METHOD]') and update the `user.loginStatus`, `user.userId`, and `user.userSegment` variables in the data layer. Provide a full `dataLayer.push()` example for a login using '[AUTH_METHOD]'.

Document GA4 'view_item_list' Event

Generate the GA4-compliant data layer for viewing a list of products.

Create the data layer specification for a GA4 `view_item_list` event. The spec must include the `ecommerce` object with an `item_list_name` (e.g., 'Search Results') and an `items` array. Each item should include `item_id`, `item_name`, `price`, and `item_category`. Provide an example for a 'Category: Shoes' page.

Specify GA4 'remove_from_cart' Event

Document the data layer push for when a user removes an item from their shopping cart.

Write the technical specification for a GA4-compliant `remove_from_cart` event. The data layer push must include the `ecommerce` object and an `items` array containing the full details of the product that was removed. Provide a complete JSON example.

Document 'search' Event for [CONTEXT]

Define a data layer event to capture user search queries on the website.

Generate a data layer specification for a `search` event for a [WEBSITE_AREA, e.g., product catalog, blog content]. The event should fire when a user performs a search. Include the parameter `search_term` with the user's query, `search_category` (if applicable), and `search_results_count`. Provide an example `dataLayer.push()` for a search for '[SEARCH_TERM]' with '15' results.

Data Layer Implementation Notes for Devs

Draft a section for developers on best practices for pushing data to the data layer.

Write a detailed 'Notes for Developers' section for a data layer specification document, tailored for a [FRONTEND_FRAMEWORK, e.g., React, Vue, generic HTML/JS] environment. Cover these key points: 1. The `dataLayer` object must be declared as an array before the GTM container snippet. 2. Always use `dataLayer.push()` to add new information; explicitly warn against overwriting the object directly....

Specify GA4 'begin_checkout' Event

Define the data layer specification for the GA4 'begin_checkout' event.

Act as a GA4 specialist. Write the complete data layer specification for a `begin_checkout` event. The push must include `currency`, `value`, and an `items` array containing all products in the cart at the time the checkout process begins. Provide a full JSON example.

Specify 'file_download' Event

Document an event to track downloads of files like PDFs or ZIP archives.

Create a data layer specification for a `file_download` event. The event should include the parameters `file_name`, `file_extension`, `file_url`, `link_text`, and `document_type` (e.g., 'case study', 'whitepaper'). Provide an example `dataLayer.push()` for a user downloading a '[FILE_NAME].pdf'.

PII Policy for Data Layer Documentation

Write a policy statement for the documentation warning against pushing Personally Identifiable Information (PII).

Write a clear and legally compliant policy statement to include in a data layer specification document. The statement should strictly prohibit the inclusion of Personally Identifiable Information (PII) in the data layer for analytics purposes. List comprehensive examples of PII, such as names, email addresses, phone numbers, full IP addresses, precise location data, and account numbers. Explain the rationale behind this policy (e.g., GDPR, CCPA compliance).

Document GA4 'select_promotion' Event

Specify the data layer push for when a user clicks on an internal promotion or banner.

Generate the data layer specification for a GA4 `select_promotion` event. The spec must include an `ecommerce` object with a `promotions` array. Each object in the array should have `promotion_id`, `promotion_name`, and `creative_slot`. Provide a `dataLayer.push()` example for a click on a 'Summer Sale' homepage banner.

Specify 'error_message' Event for [ERROR_TYPE]

Define an event to track when users encounter specific error messages on the site.

Generate a data layer specification for an `error_message` event for a [SPECIFIC_ERROR_CONTEXT, e.g., form validation, API failure]. This event should fire when a user-facing error is displayed. Include parameters for `error_type` (e.g., 'validation', 'server', 'network'), `error_message_text`, `error_code` (if available), and `error_location` (e.g., 'login form', 'checkout page'). Provide an example `dataLayer.push()` for a '[ERROR_TYPE]' error on the '[ERROR_LOCATION]'.

Specify GA4 'view_cart' Event

Generate the GA4-compliant data layer for when a user views their shopping cart.

Write the technical specification for a GA4 `view_cart` event. The data layer push must include `currency`, `value`, and an `items` array containing the full details of all products currently in the cart. Provide a complete JSON example.

Data Layer Naming Convention Guidelines

Establish a clear naming convention for all data layer events and variables.

Write a comprehensive set of naming convention rules for a data layer specification document, suitable for a large-scale analytics implementation. Specify the mandatory use of `snake_case` for all event names and variable names. State that event names should be descriptive, verb-object pairs (e.g., `item_viewed`, `checkout_started`). Variable names should be logical, hierarchical, and follow dot notation (e.g., `page.pageName`, `ecommerce.items.item_id`). Provide 5 good examples and 5 bad examples illustrating these rules, explaining why each is good or bad.

Specify GA4 'add_shipping_info' Event

Create the data layer spec for the GA4 'add_shipping_info' event in a checkout flow.

Create the data layer specification for a GA4 `add_shipping_info` event. The push must include `currency`, `value`, `shipping_tier` (e.g., 'Ground', 'Express'), and the full `items` array. Provide a complete JSON example.

Data Layer Doc Version History Template

Create a template for a version history (changelog) table in the documentation.

Generate a markdown table to be used as a detailed version history (changelog) for a data layer specification document. The columns should be 'Version', 'Date', 'Author/Team', 'Description of Changes', and 'Impacted Events/Variables'. Populate it with three example entries: one for an initial release 'v1.0', one for a minor update 'v1.1' where a new `user_type` variable was added, and one for a bug fix 'v1.1.1' related to an `add_to_cart` event parameter.

Document GA4 'add_payment_info' Event

Specify the data layer push for when a user adds their payment information during checkout.

Write the technical specification for a GA4 `add_payment_info` event. The data layer push must include `currency`, `value`, `payment_type` (e.g., 'credit_card', 'paypal'), and the full `items` array. Do not include any sensitive payment details. Provide a complete JSON example.

Turn these prompts into a reusable workspace

Save your favourite prompts once, reuse them with Alt+P, keep a live Table of Contents of long chats, and export conversations when you're done.

Add ChatBoost to Chrome — It's free

Related Prompt Packs