Browsee
  • Getting Started
    • How to use Browsee on Shopify Store?
    • Shopify Stores
  • Integration
    • Snippet Integration
      • Direct JS Integration
      • GTM Integration
      • SDK Integration
      • Wordpress Integration
      • Shopify Integration
      • Troubleshooting Integration
    • Managing Recordings
    • API Calls
      • Log Event Call
      • Identify Call
      • Session Url
      • Generate Secret Key
      • Data Export API
      • Track HTTP API
      • Identify HTTP API
  • Understand Your Users
    • Session Search
      • Date Range
      • User Actions
      • User Attributes
      • Session Tags
        • Network Errors and Slowness
        • Javascript (JS) Errors
        • Frustration Clicks or Rage Clicks
        • Broken Links
        • U Turn
        • Searching For Something
        • Going in Circles
        • High Engagement
        • High Input Time
        • Repeat Pages
        • Repeat Events
      • Regular Expression Search
    • Segments
    • Segment Analytics and Alerts
    • Subscribe to a Segment
    • Configure Dashboard
    • Session Replays - Save, Share, and Delete
    • User Experience Issues
  • Heatmaps
    • Heatmaps
    • Create Heatmaps
    • Compare Heatmaps Across Date Ranges
    • Segmentation in Heatmaps
    • Heatmap Sessions
    • Dynamic Heatmaps
  • Funnels
    • Creating Funnels
    • Funnel Analytics and Alerts
  • FAQ
    • Frequently Asked Questions
    • FAQ - Browsee Installation
    • FAQ - Account and Project
    • FAQ - Session Recordings
    • FAQ - Heatmaps
    • FAQ - Payment & Plans
  • Project
    • Add User
    • Add Project
    • Setting Up SSO Login
    • Third Party Integrations
    • Content Security Policies
  • Plans and Billing
    • Recording and Sampling
  • Data Privacy
    • Privacy
    • Do Not Track Settings
    • Link Browsee with your Privacy Policy
    • GDPR Compliance
  • Feedback & Popups
    • Creating Notifications
    • When to Show
    • Where to Show
    • Advanced Targeting
    • Feedback Widget
    • Integrations
  • Request A Feature
    • Request a New Feature
Powered by GitBook
On this page
  • Examples
  • API calls

Was this helpful?

  1. Integration
  2. Snippet Integration

SDK Integration

Integration using Browsee's web client SDK.

PreviousGTM IntegrationNextWordpress Integration

Last updated 1 year ago

Was this helpful?

To install Browsee web SDK just do:

$ npm i @browsee/web-sdk --save

Or, if you are using yarn

$ yarn add @browsee/web-sdk

Now you can import and start using the SDK. You need to initialize it with your project's API key. You can find your API key in .

import browsee from '@browsee/web-sdk';
browsee.init({ apiKey: '<Your API Key>' });

Trying to use API calls before init will throw an error.

Examples

React

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import browsee from '@browsee/web-sdk';
import * as serviceWorker from './serviceWorker';
 
browsee.init({ apiKey: '<Your API Key>' });
 
ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

Next

For Next, this web-sdk is not the recommended installation method for Browsee. You can use next/script to directly add script tags.

import { Inter } from 'next/font/google'
import './globals.css'
import Script from "next/script";

const inter = Inter({ subsets: ['latin'] })

export const metadata = {
  title: 'Create Next App',
  description: 'Generated by create next app',
}

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body className={inter.className}>{children}</body>
      <Script strategy="lazyOnload">
        {`
        window._browsee = window._browsee || function () { (_browsee.q = _browsee.q || []).push(arguments) };
        _browsee('init', '<Your API Key>'); 
    `}
      </Script>
      <Script
        strategy="lazyOnload"
        src={"https://cdn.browsee.io/js/browsee.min.js"}
      />
    </html>
  )
}

Angular

import { Component } from '@angular/core';
import browsee from '@browsee/web-sdk';
 
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = '...';
 
  constructor() {
    browsee.init({ apiKey: '<Your API Key>' });
  }
}

Vue

import Vue from 'vue';
import App from './App.vue';
import browsee from '@browsee/web-sdk';
 
browsee.init({ apiKey: '<Your API Key>' });
 
new Vue({
  render: h => h(App),
}).$mount('#app')

API calls

Just like client-side API, you can use browsee object to send events, identify users or get session URL.

Sending custom events

browsee.identify('User ID', {name:...});
 
browsee.logEvent('Event Name', {key: value, ...});
 
browsee.getSessionUrl(function(url) { console.log('Current session', url); });

Learn more about these APIs .

settings or accounts page
here