- Home
- Skills
- Research & Analysis
- ga4-consent-install
Ga4 Consent Install
Implements privacy-first Google Analytics 4 with Consent Mode default-denied and policy disclosures.
$1
Works with the AI Agents you already use
ga4-consent-install
Example session with this skill installed
I need to install GA4 on my site. The measurement ID is G-8Y7T6R5E4W. Help me set up the code so it respects user consent and write the privacy policy section.
- Read your context and instructions
- Compiled the ga4-consent-install
I have configured the GA4 installation to respect Consent Mode default-denied and drafted the privacy disclosure.
GA4 Consent Implementation
<!-- Google Consent Mode Default Denied -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied'
});
</script>
<!-- Load GA4 only after consent (Trigger this on 'Accept' click) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-8Y7T6R5E4W"></script>
<script>
function initializeTracking() {
gtag('js', new Date());
gtag('config', 'G-8Y7T6R5E4W');
gtag('consent', 'update', {
'analytics_storage': 'granted'
});
}
</script>
Privacy Policy Section
Analytics Disclosure
We use Google Analytics 4 (Measurement ID: G-8Y7T6R5E4W) to understand site traffic. This tool collects page views, approximate location, and device type. Data collection is strictly disabled until you provide explicit consent via our cookie banner. You can withdraw your consent at any time by clearing your browser cookies or clicking the 'Manage Consent' link in our footer.
Next steps
- Insert the default-denied script block above your site head.
- Link your cookie banner's "Accept" button to the
initializeTracking()function. - Verify hits in the browser network log after clicking accept.
Connects securely to your tools. The creator never sees your data.
About this skill
Manual implementation of Google Analytics 4 often leads to privacy violations or broken data. This skill automates a privacy-first GA4 installation that defaults to denied consent.
What it does
- Consent gating prevents tracking tags from firing until a user explicitly clicks accept on a cookie banner.
- Default-denied mode configures Google Consent Mode to block data transmission by default.
- Privacy documentation generates necessary disclosure text including data collection types and withdrawal methods.
- Implementation verification provides a checklist for network log and Tag Assistant validation.
How it works
- Property setup where a unique measurement ID is assigned to a specific data stream.
- Tag configuration involving the placement of the script with conditional firing logic.
- Policy update to reflect the specific measurement ID and GA4 collection behaviors.
- Validation testing across key page types to ensure hits are only sent post-consent.
Frameworks & tools
This skill is designed for web developers using Google Analytics 4, Google Tag Manager, or direct gtag.js implementations.
Why this beats prompting it yourself
Generic prompts often produce tracking code that fires on page load, violating GDPR and CCPA. This skill enforces a "never track before consent" rule and includes the specific legal disclosures required for GA4.
Use cases
- Deploy GA4 to a new production site with strict privacy requirements.
- Fix an existing installation that is tracking users before they accept cookies.
- Generate compliant privacy policy sections for analytics disclosure.
- Audit a deployment to ensure the measurement ID matches the specific site.
Known limitations
Does not provide the UI components for the cookie banner itself. Standard GA4 reports may lag by 24 to 48 hours before data appears.
Does not provide cookie banner UI components. Standard GA4 reports have a 24-48 hour data lag.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 day ago
Permissions
No special permissions declared or detected