Shipped
HomeContacts
  • Get started
  • 📚Tutorials
    • Make a waiting list
    • Launch a pre-sale
    • Build a SaaS
    • Create your store on Lemon Squeezy
  • 🟩Features
    • AI Services
    • Affiliate Program
    • Analytics
    • Authentication
      • MailChimp
      • Loops
      • AWS SES
      • SendGrid
      • Supabase Auth
        • Supabase Authentication Flow
        • Supabase Magic Link
        • Supabase Email & Password
        • Supabase Login with Google
    • API endpoints
      • 🛡️Authenticated API
    • Blog
    • Customer support
    • Chrome Extension
    • Dark mode
    • Database
      • Update your database
      • MongoDB
    • Emails
    • Error pages
    • Icons
    • Onboarding
    • Payments
      • Lemon Squeezy
        • Subscriptions
        • One-time purchase
        • Test mode
      • Stripe
    • Private pages
    • SEO
    • shadcn/ui
    • Supabase
    • Workspace / Organizations
  • 📦Components
    • AccountMenu
    • CtaBox
    • DarkModeSwitch
    • Explainer video
    • FAQ
    • Features
    • Footer
    • Header
    • Hero
    • Lifetime
    • Pricing
    • Sales Notification
    • Secondary Sidebar Pages
    • Sidebar
    • Tabs
    • Testimonials
    • Waitlist
    • WebAppPage
  • 🚀Deployment
  • ✅Other
    • Configuration
    • Changelog widget
    • Favicon
    • Google Fonts
    • Sitemap
    • Theme
  • Updates
  • GitHub Repository
  • Support
Powered by GitBook
On this page
  • Pirsch
  • Setup
  • Safe routing
  • Extra
  • SimpleAnalytics

Was this helpful?

  1. Features

Analytics

Collect the basic analytics with a privacy focused analytics tool

Pirsch

Setup

  1. Create a new site on Pirsch

  2. Set the data-code in the Pirsch script tag in layout.ts

<script
    defer
    type="text/javascript"
    src="/pirsch-extended.js"
    id="pirschextendedjs"
    data-code=""
/>

Safe routing

Some browsers and ad-blockers might block the requests to the Pirsch javascript file.

To avoid that, Shipped includes a rewrite rule in next.config.js

async rewrites() {
  return [
    {
      source: "/pirsch-extended.js",
      destination: "https://api.pirsch.io/pirsch-extended.js",
    },
  ];
},

This rule is already included, so no action from you is required.

Extra

Pirsch allows you to track specific events on the page. See the documentation.

SimpleAnalytics

SimpleAnalytics is another popular analytics product.

To enable add this code to the layout.ts file

import Script from "next/script"


export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <head>
        /* ... */
        <Script src="/simple-analytics.js" />
        <noscript>
          <img
            src="/simple-analytics-noscript.gif"
            alt=""
            referrerPolicy="no-referrer-when-downgrade"
          />
        </noscript>
      </head>
      <body className={inter.className}>
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}

Then update next.config.js

async rewrites() {
  return [
    {
      source: "/simple-analytics.js",
      destination: "https://scripts.simpleanalyticscdn.com/latest.js",
    },
        {
      source: "/simple-analytics-noscript.gif",
      destination: "https://queue.simpleanalyticscdn.com/noscript.gif",
    },
  ];
},
PreviousAffiliate ProgramNextAuthentication

Last updated 1 year ago

Was this helpful?

🟩