Installation

Next.js Install Guide

Statcounter provides customisable hit counters, visitor tracking, web analytics and website stats for Next.js.

  1. Sign up for an account at Statcounter to get your code.

    These instructions will be repeated after you've created an account and added your first project.

    Already a member?

  2. Installation

    npm install @statcounter/nextjs
    or
    yarn add @statcounter/nextjs

  3. Open your root layout file (usually app/layout.tsx or app/layout.js). Import the statcounter component at the top:

    import { StatCounter } from "@statcounter/nextjs";

    Then add the <StatCounter /> component inside this layout file just before the closing </body> tag.

    <StatCounter project_id={} security_code="" />
    </body>

  4. Rebuild the site and restart the app

  5. Package npmjs page : https://www.npmjs.com/package/@statcounter/nextjs

Get Started

Sign up for a Statcounter account using our Next.js installation guide.

Try it for FREE!

Already a Member?

You can reinstall Next.js on your Statcounter project.


Installation Guides A - Z

Didn't find your answer here?

Our support team is here to help you!

Contact Support
webf001
24.955034255981