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

Beacon - Installation

NextBeacon - Usage

Last updated 1 year ago

Installing beacon.li

To get started with beacon.li and incorporate it into your project, you'll need to follow these simple steps for installation.

Prerequisites

Before you proceed, ensure that you have Node.js and npm (Node Package Manager) installed on your system. If you haven't already, you can download them from .

Installation

Once you have Node.js and npm set up, open your terminal or command prompt and execute the following command to install Beacon.li:

npm install @beacon.li/bar

OR

yarn add @beacon.li/bar

OR

If you want to use a <script> tag instead, you can use the below code snippet which will import and load the beacon bar directly without npm package.

<script>
(function(b,e,a,c,o,n) {b[c] = {orgId:n, open:()=>{b[c].opened=true}};
  var s = e.createElement(a);
  s.src='https://cdn.beacon.li/sdk/latest.js';s.async=true;s.type='module';
  var d = e.createElement(o);
  d.id='beacon-user';
  e.body.appendChild(d);
  e.head.appendChild(s);
})(window, document, 'script', 'BeaconBar', 'div','ORG_ID');
</script>

This code will fetch the latest version of beacon.li and add it as a dependency to your project.

Please note that you may need to refer to the below two steps as well, for robust integration and a better experience to your users.

That's it! You're now ready to start using beacon.li in your project. If you encounter any issues during installation or have questions about how to use beacon.li, refer to our comprehensive documentation or reach out to our for assistance.

nodejs.org
Native Routing in Beacon
Implementing Content Security Policy (CSP) for Beacon Integration
support@beacon.li