PromptBase
PromptBase SelectGet Select
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Skill Details

Runtime
(claude-5-5-sonnet)
Example user message
[userMessage]: - **Marketing Request:** We need to track when users click the "Download Enterprise Report" button on the new landing page. - **Element/Page Details:** The button has the ID 'download-btn-ent' and is located on '/landing-pages/enterprise-strategy'. We need to know the user's industry if they are logged in.
Example agent response
## 1. Tracking Overview Track clicks on the "Download Enterprise Report" button (`#download-btn-ent`) on `/landing-pages/enterprise-strategy`. The business objective is to measure gated-content engagement on the enterprise landing page and segment it by the visitor's industry, so marketing can see which verticals are most interested in the report. Industry is captured only for logged-in users. For anonymous visitors the event still fires, with industry set to `not_logged_in`. ## 2. dataLayer Push (Developer Implementation) Attach the push to the button's click handler. Read the industry from the authenticated user object at click time, not at page load, so the value is current. ```javascript window.dataLayer = window.dataLayer || []; document.getElementById('download-btn-ent').addEventListener('click', function () { // Replace `window.currentUser` with your app's actual auth/user object var isLoggedIn = !!(window.currentUser && window.currentUser.id); var industry = isLoggedIn && window.currentUser.industry ? String(window.currentUser.industry).toLowerCase() : (isLoggedIn ? 'unknown' : 'not_logged_in'); window.dataLayer.push({ event: 'download_enterprise_report', content_name: 'Enterprise Report', content_type: 'report', button_id: 'download-btn-ent', page_path: '/landing-pages/enterprise-strategy', login_status: isLoggedIn ? 'logged_in' : 'logged_out', user_industry: industry }); }); ``` **Implementation notes for developers:** - Do **not** push PII (name, email, user ID) in this event. - Use a single, consistent lowercase taxonomy for `user_industry` values (e.g., `finance`, `healthcare`, `retail`). - If the button triggers a navigation or file download, make sure the push happens before navigation. This is normally fine with a click listener, but verify in testing. - If the button is rendered dynamically (SPA or lazy-loaded), use event delegation, e.g. `document.addEventListener('click', e => { if (e.target.closest('#download-btn-ent')) { ... } })`. ## 3. Google Tag Manager (GTM) Configuration - **Trigger Type:** Custom Event - **Event Name:** `download_enterprise_report` (exact match, case-sensitive; do not use regex) - **Firing Conditions:** Fire on "Some Custom Events" with the following condition: - `Page Path` equals `/landing-pages/enterprise-strategy` **Data Layer Variables to create (Version 2):** | GTM Variable Name | Data Layer Variable Name | |---|---| | DLV - content_name | `content_name` | | DLV - content_type | `content_type` | | DLV - button_id | `button_id` | | DLV - login_status | `login_status` | | DLV - user_industry | `user_industry` | **GA4 Event Tag:** - **Tag Type:** Google Analytics: GA4 Event - **Configuration/Measurement ID:** your GA4 Measurement ID (or the GA4 Configuration tag variable) - **Event Name:** `download_enterprise_report` - **Event Parameters:** map each parameter name to its DLV variable above (`content_name`, `content_type`, `button_id`, `login_status`, `user_industry`) - **Trigger:** the Custom Event trigger defined above **Fallback (if developer dataLayer work is delayed):** Use a Click trigger ("All Elements" → "Some Clicks") with `Click ID equals download-btn-ent` AND `Page Path equals /landing-pages/enterprise-strategy`. Note that this fallback cannot access `user_industry` unless the industry is already exposed in the dataLayer or a first-party cookie, so the dataLayer push is the recommended approach. ## 4. GA4 Custom Dimensions Mapping Register these in **GA4 Admin → Custom definitions → Create custom dimension**. Event-scoped dimensions are needed for all parameters except where noted. | Parameter Name | Dimension Name | Scope | Description | |---|---|---|---| | `user_industry` | User Industry | Event | Industry of the logged-in user at time of click. Values: lowercase industry slug, `unknown` (logged in but not set), or `not_logged_in`. | | `login_status` | Login Status | Event | Whether the user was authenticated at time of click (`logged_in` / `logged_out`). | | `content_name` | Content Name | Event | Name of the asset being downloaded (`Enterprise Report`). Useful if more reports are added later. | | `content_type` | Content Type | Event | Type of content (`report`). | | `button_id` | Button ID | Event | HTML ID of the clicked element (`download-btn-ent`). | **Additional recommendations:** - If `user_industry` should also describe the user across *all* events (not just this click), additionally set it as a **User Property** (`user_industry`, scope: User) via a `set` on the GA4 Configuration tag or a user-properties field on the Event tag, then register it as a User-scoped dimension. - Consider marking `download_enterprise_report` as a **Key Event** in GA4 (Admin → Events) if it represents a conversion. - `page_path` is collected automatically by GA4 as `page_location`, so no custom dimension is needed. It is included in the push for use as a GTM trigger condition. - GA4 standard properties allow up to 50 event-scoped custom dimensions, so check your quota before registering. - Custom dimensions populate in reports only for data collected after registration (typically 24-48 hours). **QA checklist:** Verify in GTM Preview mode that the `download_enterprise_report` event appears in the Data Layer tab with correct values for both a logged-in and an anonymous session. Then confirm in GA4 DebugView that all five parameters arrive on the event.
Claude Skill

Ga4 Event Tracking Spec Writer

Add to Cart
PromptBase Select
Get this skill + 9 more with Select$14 your first month, then $19/mo$14 first month, then $19/mo
View Select
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this skill, you agree to our terms of service
CLAUDE-5-5-SONNET
Tested icon
Guide icon
Free credits icon
Bridge the gap between marketing and development! The GA4 Event Tracking Spec Writer translates vague marketing requests into technical, developer-ready implementation specs for Google Tag Manager. Save hours of back-and-forth, eliminate data collection errors, and ensure nicely mapped custom dimensions for your digital analytics infrastructure.
...more
Added 3 days ago
Report
Browse Marketplace