Generate Data Layer Documentation 3x Faster with AI Prompts
Tired of spending hours writing tedious data layer specifications? Our curated collection of AI prompts helps you generate accurate, consistent, and comprehensive documentation in a fraction of the time. Streamline your analytics implementation process, reduce errors, and ensure your developers and marketers are perfectly aligned.
Quickly outline the foundational data layer object structure for a new website or application.
Act as a senior data analyst. Generate a standard data layer object structure for a new [WEBSITE_TYPE] website named '[YOUR_WEBSITE_NAME]'. Include essential top-level keys like 'page', 'user', and 'ecommerce'. For each key, provide 3-5 example variables with descriptions and data types (e.g., pageName: string, user.isLoggedIn: boolean). Focus on [PRIMARY_GOAL_OF_WEBSITE] to tailor variables.
Define Naming Conventions
Establish a clear and consistent naming convention guide for all data layer events and variables.
Create a comprehensive naming convention guide for a [WEBSITE_TYPE] data layer specification. The guide should cover events and variables. For events, specify a format like 'event_verb_object' (e.g., 'click_button'). For variables, recommend camelCase and provide rules for prefixes (e.g., 'user', 'page'). Provide 5 good and 5 bad examples relevant to [INDUSTRY] for clarity.
Create Event Spec Markdown Template
Generate a reusable markdown template for documenting a single data layer event.
Create a comprehensive markdown template for documenting a single data layer event. The template should include the following sections: Event Name, Description, Trigger, Variables (in a table with columns: Variable Name, Data Type, Description, Example Value), and Example `dataLayer.push()` Code. Ensure it's suitable for [SPECIFIC_PLATFORM] (e.g., GA4) requirements.
Document a 'page_view' Event
Generate the complete specification for a standard 'page_view' event.
Using this markdown template:
**Event Name:**...
Document an 'addToCart' Event
Create the data layer specification for an e-commerce 'addToCart' event.
Generate the data layer specification for an 'addToCart' event on an e-commerce site for [PRODUCT_CATEGORY] products. The event should follow the [ANALYTICS_PLATFORM] e-commerce schema (e.g., GA4). The documentation should include an 'items' array of objects, with each object containing item_id, item_name, price, and quantity. Provide a complete `dataLayer.push()` example with two specific items being added to the cart.
Document a 'purchase' Event
Generate the complete specification for a 'purchase' event, including transaction and item details.
Generate the data layer specification for a 'purchase' event following the [ANALYTICS_PLATFORM] e-commerce schema (e.g., GA4). The documentation must include top-level transaction details (transaction_id, value, currency, tax, shipping, coupon) and an 'items' array with product details (item_id, item_name, price, quantity, item_category, affiliation). Provide a full `dataLayer.push()` example for a purchase worth [TOTAL_VALUE] [CURRENCY] with [NUMBER_OF_ITEMS] items.
Document a 'form_submission' Event
Create the specification for a specific form submission event to track leads or inquiries.
Create the data layer specification for a specific 'form_submission' event, such as a '[FORM_TYPE]' form. The event should include variables like formId, formName, formDestination, and formStatus (e.g., 'success', 'error'). Do not include any PII. Explain why PII should be excluded and suggest what to track instead. Provide an example `dataLayer.push()` for a '[FORM_NAME]' form submission.
Generate a Data Dictionary Table
Create a summary table of all data layer variables for a quick reference guide.
I will provide a list of data layer variables relevant to a [WEBSITE_TYPE] website. Organize them into a markdown table with the following columns: Variable Name, Data Type, Description, and Associated Events. Here is the list: [PASTE_YOUR_LIST_OF_VARIABLES_HERE, e.g., pageName, user.loginStatus, ecommerce.items, formId, product.id].
Create a Developer Validation Checklist
Generate a checklist for developers to use when implementing and testing the data layer.
Create a technical implementation and QA checklist for a developer implementing a data layer on a [PLATFORM] (e.g., Shopify, custom React app). The checklist should include points like: Is the data layer object initialized before the GTM container snippet? Are all variable data types correct? Are PII variables excluded? Does the event fire on the correct user interaction (e.g., 'click', 'submit')? Is the data layer push correctly formatted? Include specific steps for [TESTING_ENVIRONMENT] (e.g., Chrome DevTools).
Explain a Variable to Stakeholders
Translate a technical data layer variable's purpose into simple terms for non-technical stakeholders.
Explain the purpose and importance of the data layer variable '[VARIABLE_NAME]' (e.g., 'user.lifetimeValue', 'product.inventoryStatus') to a non-technical [STAKEHOLDER_ROLE] (e.g., marketing manager, product owner). Use an analogy to clarify what it represents and provide two specific examples of how they could use this data in their [THEIR_WORK_AREA] (e.g., marketing campaigns, product roadmap decisions).
Document SPA Page View Tracking
Specify how to handle page view tracking in a Single Page Application (SPA).
Create a detailed data layer specification for tracking virtual page views in a Single Page Application (SPA) built with [FRONTEND_FRAMEWORK] (e.g., React, Angular). The event should be named '[CUSTOM_EVENT_NAME]' (e.g., 'virtual_page_view'). Detail the trigger mechanism (e.g., on route change via React Router) and the specific variables to be pushed, including the new page path, page title, and a referrer if applicable. Provide an example `dataLayer.push()` for a new [PAGE_TYPE] page.
Generate JSON Schema for an Event
Create a formal JSON schema to enforce the structure of a specific data layer event.
Generate a robust JSON schema for a '[EVENT_NAME]' (e.g., 'product_view', 'checkout_step') data layer event. The schema should enforce the presence of an '[OBJECT_NAME]' object containing an '[ARRAY_NAME]' array. Each item in the array must be an object with required properties: '[PROPERTY1]' (string), '[PROPERTY2]' (string), and '[PROPERTY3]' (number), and optional properties like '[OPTIONAL_PROPERTY]'.
Document a 'newsletter_signup' Event
Create the data layer specification for a successful newsletter signup event.
Generate the data layer specification for a 'newsletter_signup' event that fires upon successful form submission. Include a 'signupLocation' variable to track where the signup occurred (e.g., 'footer', 'popup', 'blog_post') and a 'signupSource' variable (e.g., 'organic', 'paid'). Provide an example `dataLayer.push()` for a [LOCATION] signup.
Document User Login/Logout Events
Create specifications for both 'login' and 'logout' user events.
Generate data layer specifications for two separate events: 'login' and 'logout'. For the 'login' event, include a 'method' variable (e.g., 'email', 'google', 'facebook') and a 'userType' variable (e.g., 'returning', 'new'). For both events, ensure a 'user.loginStatus' variable is updated. Provide `dataLayer.push()` examples for a [LOGIN_METHOD] login and a logout.
Draft GTM Trigger Configuration
Write instructions for a GTM specialist on how to configure a trigger for a custom event.
Write clear, step-by-step instructions for a Google Tag Manager specialist to create a trigger for the custom event '[CUSTOM_EVENT_NAME]' (e.g., 'generate_lead', 'product_impression'). The trigger should be of type 'Custom Event' and the event name should be exactly '[CUSTOM_EVENT_NAME]'. Specify that this trigger should fire on [PAGES_CONDITION] (e.g., 'all pages', 'some pages where Page Path matches /thank-you/').
Document a 'video_progress' Event
Create a specification for tracking user engagement with embedded videos.
Generate the data layer specification for a 'video_progress' event. The event should fire when a user reaches 25%, 50%, 75%, and 100% of a video. Include variables for 'video_title', 'video_id', 'video_provider' (e.g., 'YouTube', 'Vimeo', 'self-hosted'), and 'video_percent_complete'. Provide an example `dataLayer.push()` for the [PERCENTAGE]% milestone of a video titled '[VIDEO_TITLE]'.
Document Error Message Tracking
Specify an event to capture user-facing error messages, like form validation errors.
Create a data layer specification for an 'error_message_shown' event. This event should track when a user encounters and sees an error message on the site, specifically within a [CONTEXT] (e.g., form submission, API call failure). Include variables like 'error_type' (e.g., 'form_validation', 'api_error', 'system_error'), 'error_message_text', and 'error_location' (e.g., 'login_page', 'checkout_step_2'). Provide an example `dataLayer.push()` for an error on the [PAGE/SECTION].
Document 'begin_checkout' Event
Create the data layer specification for the initiation of the checkout process.
Generate the data layer specification for a 'begin_checkout' event, following the [ANALYTICS_PLATFORM] e-commerce schema (e.g., GA4). The event must include the 'currency', 'value', and the full 'items' array from the user's cart at the moment they start the checkout. Also include an optional 'coupon' field. Provide a complete `dataLayer.push()` example for a checkout with [NUMBER_OF_ITEMS] items and a value of [TOTAL_VALUE] [CURRENCY].
Document 'view_item_list' Event
Specify the event for when a user views a list of products, like on a category page.
Generate the data layer specification for a 'view_item_list' event, following the [ANALYTICS_PLATFORM] e-commerce schema (e.g., GA4). The event should include 'item_list_name' (e.g., 'Category: T-Shirts', 'Search Results: Red Shoes') and an 'items' array containing details for each product visible on the page (item_id, item_name, price, item_category, index). Provide an example for a [LIST_TYPE] page with [NUMBER_OF_ITEMS] products.
Generate JSDoc for a Helper Function
Create JSDoc comments for a JavaScript function that pushes data to the data layer.
Write a complete JSDoc comment block for a JavaScript helper function named '[FUNCTION_NAME]' (e.g., 'pushToDataLayer', 'trackAnalyticsEvent'). The function accepts one argument: `eventData` (an object) which represents the data to be pushed. The JSDoc should clearly describe what the function does, define the `@param` for `eventData` including its expected structure, and include a `@example` showing its usage with specific event data for a '[EXAMPLE_EVENT]' event.
Document Consent Management Variables
Specify data layer variables for tracking user consent status (e.g., for GDPR/CCPA).
Create a data layer specification for variables related to user consent management for [REGULATION] (e.g., GDPR, CCPA). Define variables for different consent categories, such as 'consent_analytics', 'consent_marketing', and 'consent_personalization'. The values should be 'granted' or 'denied'. Explain when and how these variables should be updated by the Consent Management Platform (CMP), and provide an example `dataLayer.push()` for initial consent setup.
Document a 'search' Event
Create the specification for a site search event, capturing the search term.
Generate the data layer specification for a 'search' event. The event should fire when a user performs a search on the website, particularly on a [SEARCH_LOCATION] (e.g., header search bar, dedicated search page). Include the required 'search_term' variable and an optional 'search_results_count' variable. Provide an example `dataLayer.push()` for a search term like '[SEARCH_QUERY]' with [NUMBER] results.
Create a Phased Implementation Plan
Outline a phased approach for rolling out a new data layer implementation.
Outline a detailed 3-phase implementation plan for a new data layer on an e-commerce website that uses [ANALYTICS_PLATFORM] (e.g., GA4). Phase 1 should cover foundational elements (page view, user identification, site search). Phase 2 should cover core e-commerce events (product views, add to cart, remove from cart). Phase 3 should cover the full checkout funnel, purchase event, and advanced user engagement (e.g., video tracking). Briefly describe the goal and key deliverables for each phase.
Document 'remove_from_cart' Event
Create the data layer specification for a 'remove_from_cart' e-commerce event.
Generate the data layer specification for a 'remove_from_cart' event, following the [ANALYTICS_PLATFORM] e-commerce schema (e.g., GA4). The event must include the 'currency', 'value' (of the removed item), and an 'items' array containing only the single object of the specific product that was removed (item_id, item_name, price, quantity, item_category). Provide a complete `dataLayer.push()` example for removing '[PRODUCT_NAME]' with quantity [QUANTITY].
Draft an Onboarding Email for Devs
Write a brief email to a developer, introducing them to the data layer documentation.
Draft a brief, friendly, and informative email to a new developer on the team named '[DEVELOPER_NAME]'. The email should introduce them to the data layer specification document, explain its critical purpose (to ensure consistent and accurate analytics tracking for [BUSINESS_GOAL]), and provide a direct link to the full documentation: [DOCUMENTATION_URL]. Emphasize the importance of following the established naming conventions and event structures for [PROJECT_NAME].
Document 'scroll_depth' Event
Create a specification for tracking how far users scroll down a page.
Generate the data layer specification for a 'scroll_depth' event. The event should fire when a user scrolls to 25%, 50%, 75%, and 90% of a page's total height on a [PAGE_TYPE] (e.g., blog post, product detail page). Include a 'scroll_depth_threshold' variable to capture the percentage reached and a 'page_type' variable. Provide an example `dataLayer.push()` for the [PERCENTAGE]% threshold on a '[PAGE_TITLE]' page.
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.