Beacon API Docs
  • Beacon - Installation
  • Beacon - Usage
    • Beacon Usage - Overview
    • Usage in a Next.js Environment
    • Open and Close Programmatically
  • Native Routing in Beacon
    • Vanilla JS - Native Routing Example
    • React JS - Native Routing Example
    • Vue JS - Native Routing Example
    • Angular JS - Native Routing Example
  • Loading User Data into BeaconBar
  • Loading Session Data into Beacon Bar
  • Callbacks in Beacon
    • Add Callbacks in Beacon
    • Remove Callbacks in Beacon
    • React Example for Callbacks
  • Trigger smart journeys From Your App
  • Execute Command From Your App
  • Open Help Docs From Your App
  • Emitting Events to Beacon
  • Listening to events from Beacon Bar
    • Adding event listeners in Beacon
    • Removing event listeners in Beacon
    • React Example for Event Listeners in Beacon
  • List of events emitted by Beacon Bar
  • Implementing Content Security Policy (CSP) for Beacon Integration
Powered by GitBook
On this page

Loading Session Data into Beacon Bar

Scenario: The objective is to load user metaData and retain it throughout the entire session.

Configuration during server-side rendering:

<script>
  // Ensure BeaconBar.user is initialized
  if (!BeaconBar.user) {
    BeaconBar.user = {};
  }
  
  // Set the sessionData object for user
  BeaconBar.user.sessionData = {
    // Define session data properties here
  };
</script>

On the client side using the API:

// Load session data using BeaconBar API
BeaconBar.loadSessionData({
   // Specify session data properties here
});
PreviousLoading User Data into BeaconBarNextCallbacks in Beacon

Last updated 1 year ago