Skip to Content
AI Powered Docs! 🤖 These docs are translated with AI, so keep an eye out for minor quirks. We're always improving!

Installation and Setup

To install and start using the Metrix WebSDK , follow the steps below:

To install using npm, run the following command in your project:

npm install @metrixorg/websdk

After installation, initialize the Metrix WebSDK in your project using the following code:

import { init } from '@metrixorg/websdk'; init(APP_ID, API_KEY, config);

Using the <script> tag:


If you cannot install via npm, you can include the script directly inside your project’s <head> tag:

<script src="https://cdn.metrix.ir/sdk/web/metrix.umd-2.4.0.js"></script>

After adding the script, initialize the Metrix WebSDK using one of the methods below:

typescript:

declare let Metrix: any; Metrix.init(APP_ID, API_KEY, config);

javascript:

Metrix.init(APP_ID, API_KEY, config);

The parameters that the init method receives are shown in the table below:

NameTypeDescriptionRequired
APP_IDstringThe unique identifier for your application. You can find this in your Metrix dashboard under Workspace -> Settings -> App Info.Yes
API_KEYstringObtain this key from Workspace -> Settings -> Api Key -> Generate Api Key in your Metrix dashboard, or create a new one.Yes