Add google analytics: Free AI Prompt | SheCodes

Free AI prompt · The Launch Book

Add google analytics

A ready-to-use prompt from the chapter Analytics. Paste it into Claude, ChatGPT, Lovable, Bolt or any AI coding tool.

The prompt

“Add Google Analytics to my Next.js app. Track page views automatically and set up custom events for [button clicks / form submissions / sign-ups].”

How to use it

  1. Fill in the blanks with your own details, so the AI builds your project, not a generic one.
  2. Copy the prompt and paste it into your AI coding tool.
  3. Check the result in the preview, then ask for changes one at a time: "make the buttons bigger", "use my brand colours".
  4. Read the chapter to understand why it works and what to do next.

More prompts like this

All prompts

Add Vercel Analytics

“Add Vercel Analytics to my Next.js project. Install the package and add the Analytics component to my root layout. I want to track page views and Web Vitals.”

Add Google Analytics

“Add Google Analytics (GA4) to my Next.js project. My measurement ID is G-XXXXXXXXXX. Add the tracking script to my root layout and make sure it works with client-side navigation. Don't track users until they accept cookies.”

Add PostHog

“Add PostHog analytics to my Next.js project. Set up the PostHog provider in my layout, configure it to track page views automatically, and show me how to track custom events like button clicks.”

Add Plausible

“Add Plausible Analytics to my Next.js project. Add the lightweight script tag to my root layout. My domain is mydomain.com. Make sure it tracks page views on client-side navigation.”

Build an analytics dashboard

“Add a simple analytics dashboard to my admin panel that shows [total users, page views this week, most popular pages] using data from my database.”

Copy this mega-prompt:

“Set up comprehensive SEO for my website. For every page, add a unique title (under 60 characters) and description (under 160 characters) that include relevant keywords. Add social sharing previews so links look good when shared on social media, including a 1200×630 preview image. Make sure every image has descriptive alt text. Generate a sitemap that automatically updates when new pages are added. Make sure search engines can find all my public pages but are blocked from crawling my admin area and behind-the-scenes endpoints. Make sure all headings follow a logical order (one main heading per page, then sub-headings below it). Add structured data for [FAQ pages / blog posts / products, pick what applies to your site].”