FullStory's browser SDK lets you manage FullStory recording on your site as well as retrieve deep links to session replays and send your own custom events. More information about the FullStory API can be found at https://developer.fullstory.com.
npm i @fullstory/browser --save
yarn add @fullstory/browser
Call the init()
function with options as soon as you can in your website startup process.
The only required option is orgId
, all others are optional.
orgId
- Sets your FullStory Org Id. Find out how to get your Org Id here.debug
- When set totrue
, enables FullStory debug messages; defaults tofalse
.namespace
- Sets the global identifier for FullStory when conflicts withFS
arise; see help.recordCrossDomainIFrames
- Defaults tofalse
. FullStory can record cross-domain iFrames if: 1. The FullStory Browser SDK is running in the cross-domain iFrame and 2.recordCrossDomainIFrames
is set totrue
in the cross-domain iFrame and 3. The FullStory Browser SDK is running in the parent page of the cross-domain iFrame. Click here for a detailed explanation of what "cross-domain" means. Before using, you should understand the security implications, and configure your Content Security Policy (CSP) HTTP headers accordingly - specifically the frame-ancestors directive. Failure to configure your CSP headers while using this setting can bypass IFrames security protections that are included in modern browsers. More information about cross-domain iFrame recording can be found on our Knowledge Base. Note: therecordCrossDomainIFrames
parameter is the same as thewindow['_fs_run_in_iframe']
referenced in the KB article.recordOnlyThisIFrame
- When set totrue
, this tells FullStory that the IFrame is the "root" of the recording and should be its own session; defaults tofalse
. Use this when your app is embedded in an IFrame on a site not running FullStory or when the site is running FullStory, but you want your content sent to a different FullStory org.devMode
- Set totrue
if you want to deactivate FullStory in your development environment. When set totrue
, FullStory will shutdown recording and all subsequent SDK method calls will be no-ops. At the timeinit
is called withdevMode: true
, a singleevent
call will be sent to FullStory to indicate that the SDK is indevMode
; this is to help trouble-shoot the case that the SDK was accidentally set todevMode: true
in a production environment. Additionally, any calls to SDK methods willconsole.warn
that FullStory is indevMode
. Defaults tofalse
.
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as FullStory from '@fullstory/browser';
FullStory.init({ orgId: '<your org id here>' });
ReactDOM.render(<App />, document.getElementById('root'));
import { Component } from '@angular/core';
import * as FullStory from '@fullstory/browser';
import { environment } from '../environments/environment';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
constructor() {
FullStory.init({ orgId: '<your org id here>',
devMode: !environment.production });
}
}
import Vue from 'vue';
import App from './App.vue';
import * as FullStory from '@fullstory/browser';
FullStory.init({ orgId: '<your org id here>' });
Vue.prototype.$FullStory = FullStory;
new Vue({
render: h => h(App)
}).$mount('#app');
import { createApp } from 'vue'
import App from './App.vue'
import * as FullStory from '@fullstory/browser';
FullStory.init({ orgId: '<your org id here>' });
const app = createApp(App);
app.config.globalProperties.$FullStory = FullStory;
app.mount('#app');
Once FullStory is initialized, you can make calls to the FullStory SDK.
FullStory.event('Subscribed', {
uid_str: '750948353',
plan_name_str: 'Professional',
plan_price_real: 299,
plan_users_int: 10,
days_in_trial_int: 42,
feature_packs: ['MAPS', 'DEV', 'DATA'],
});
const startOfPlayback = FullStory.getCurrentSessionURL();
const playbackAtThisMomentInTime = FullStory.getCurrentSessionURL(true);
FullStory.setVars('page', {
pageName : 'Checkout', // what is the name of the page?
cart_size_int : 10, // how many items were in the cart?
used_coupon_bool : true, // was a coupon used?
});
For more information on setting page vars, view the FullStory help article on Sending custom page data to FullStory.
FullStory.setVars(<scope>, <payload>)
currently only supports a string value of "page" for the scope. Using arbitrary strings for the scope parameter will result in an Error that will be logged to the browser console or discarded, depending on whether devMode or debug is enabled.