Gatsby

How to install Clarity on Gatsby

Step 1

Navigate to the root of your Gatsby project.

Step 2

Open your preferred command line and run one of the following commands
npm install gatsby-plugin-clarity
or
yarn add gatsby-plugin-clarity

Step 3

Navigate to gatsby-config.js.

Step 4

Locate your Clarity ID and copy it.

  1. From the Clarity dashboard, go to Settings.
  2. From the left menu, click Setup.
  3. Under How to install Clarity, select Install tracking code on third-party platforms.
  4. Select Gatsby. Your Clarity ID is at the top of the page (for example, 555u86t011).

Copy your Clarity ID.

Step 5

Add the following to your plugins array

    {
      resolve: `gatsby-plugin-clarity`,
      options: {
        clarity_project_id: YOUR_PROJECT_ID,
        // Boolean value for enabling clarity while developing
        // true will enable clarity tracking code on both development and production environments
        // false will enable clarity tracking code on production environment only
        enable_on_dev_env: true
      },
    }

Step 6

The Clarity tracking code is now installed.

Verification

There are two ways to verify if Clarity is running correctly on your website. Check Verification to know more.

FAQ

For more answers, refer to Setup FAQ.

Explore more

Visit Clarity