Fullstory

FullStory is a digital experience intelligence platform. Apps can leverage conversion funnels, advanced search capabilities, user session replays, and robust debugging and developer tools.

Setup

Amplitude plugin setup

A variant of an Amplitude Destination Plugin is required to forward events to FullStory. Below is a template of a Destination Plugin tailored for FullStory. It creates an instance of the FullStory browser SDK and forwards tracked events from Amplitude's SDK. This template is customizable for any needs.

1import { DestinationPlugin, Event, PluginType, Result } from '@amplitude/analytics-types';
2 
3export class FullstoryPlugin implements DestinationPlugin {
4 name = 'fullstory';
5 type = PluginType.DESTINATION as const;
6 fsOrg: string;
7 FS: Object
8 
9 constructor(fsOrg: string) {
10 this.fsOrg = fsOrg;
11 this.FS = window.FS;
12 }
13 
14 async setup(): Promise<void> {
15 window._fs_host||(window._fs_host="fullstory.com",window._fs_script="edge.fullstory.com/s/fs.js",window._fs_org=this.fsOrg,window._fs_namespace="FS",function(n,t,e,o,s,c,i,f){e in n?n.console&&n.console.log&&n.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'):((i=n[e]=function(n,t,e){i.q?i.q.push([n,t,e]):i._api(n,t,e)}).q=[],(c=t.createElement(o)).async=1,c.crossOrigin="anonymous",c.src="https://"+_fs_script,(f=t.getElementsByTagName(o)[0]).parentNode.insertBefore(c,f),i.identify=function(n,t,e){i(s,{uid:n},e),t&&i(s,t,e)},i.setUserVars=function(n,t){i(s,n,t)},i.event=function(n,t,e){i("event",{n:n,p:t},e)},i.anonymize=function(){i.identify(!1)},i.shutdown=function(){i("rec",!1)},i.restart=function(){i("rec",!0)},i.log=function(n,t){i("log",[n,t])},i.consent=function(n){i("consent",!arguments.length||n)},i.identifyAccount=function(n,t){c="account",(t=t||{}).acctId=n,i(c,t)},i.clearUserCookie=function(){},i.setVars=function(n,t){i("setVars",[n,t])},i._w={},f="XMLHTTPRequest",i._w[f]=n[f],f="fetch",i._w[f]=n[f],n[f]&&(n[f]=function(){return i._w[f].apply(this,arguments)}),i._v="1.3.0")}(window,document,window._fs_namespace,"script","user"));
16 this.FS = window.FS;
17 }
18 
19 async execute(event: Event): Promise<Result> {
20 if (event.event_type === '$identify') {
21 this.FS.identify(event.user_id)
22 
23 } else {
24 this.FS.event(event.event_type, event.event_properties)
25 }
26 
27 return {
28 code: 200,
29 event: event,
30 message: 'Event forwarded to FullStory',
31 };
32 }
33}

Amplitude plugin use

Inside the app's code, the plugin may then be imported and added to the Amplitude SDK instance.

1import * as amplitude from '@amplitude/analytics-browser';
2import { FullstoryPlugin } from './FullstoryPlugin';
3 
4amplitude.init(AMPLITUDE_API_KEY);
5amplitude.add(new FullstoryPlugin(FULLSTORY_KEY));
6 
7amplitude.logEvent('open app');
Was this page helpful?

Thanks for your feedback!

April 19th, 2024

Need help? Contact Support

Visit Amplitude.com

Have a look at the Amplitude Blog

Learn more at Amplitude Academy

© 2024 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.