Giter Club home page Giter Club logo

vite-plugin-ms-clarity's Introduction

vite-plugin-ms-clarity

Vite plugin for Microsoft Clarity.

Usage

// vite.config.js
import { defineConfig } from "vite";
import MsClarity from "vite-plugin-ms-clarity";

export default defineConfig({
  plugins: [MsClarity("YOUR-CLARITY-PROJECT-ID")],
});

If you only want to enable the plugin when an environment variable is set, you can use the plugin like this:

defineConfig({
  plugins: [process.env.ENABLE_CLARITY && MsClarity("YOUR-CLARITY-PROJECT-ID")],
});

You can also use an object as the option:

MsClarify({
  id: "YOUR-CLARITY-PROJECT-ID",
  enableInDevMode: true,
  // ...
});

Options

id

Type: string | undefined

Example: k4vhy94oj3

The ID of the project Clarity provides to you.

Can be found in the URL of your project.

script

Type: string | undefined

Default: undefined

The code to inject in the HTML.

If provided, the id option will be ignored.

If not provided, the script provided by Clarity will be used, with the id provided.

enableInDevMode

Type: boolean

Default: false

Whether to inject the script in development mode.

injectTo

Type: vite.HtmlTagDescriptor["injectTo"]

Default: "head-prepend"

Where to inject the script.

vite-plugin-ms-clarity's People

Contributors

kermanx avatar

Stargazers

Janusz Dziurzyński avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.