Installing AppSignal for JavaScript
Please follow the installation guide first, when adding a new application to AppSignal.
Creating a Push API Key
Before you begin, you'll need to find your Push API key on the "Push and deploy" section of your App settings page. You'll be able to find your API key under the "Front-end error monitoring". Once you have your key, follow the instructions under the Installation section to use it in your application.
Installation
First, add the @appsignal/javascript
package to your package.json
. Then, run yarn install
/npm install
. You'll also need a Front-end error monitoring key from the "Push and deploy" section of your App settings page.
You can also add these packages to your package.json
on the command line:
yarn add @appsignal/javascript
npm install --save @appsignal/javascript
Create an appsignal.js
file to require and configure AppSignal. This file may also be placed in another file location, like in the src/
directory. Check with your team the best location for this file, but make sure to name it appsignal.js
. For more information about the configuration, see our configuration section.
// appsignal.js
import Appsignal from "@appsignal/javascript"; // For ES Module
const Appsignal = require("@appsignal/javascript").default; // For CommonJS module
export const appsignal = new Appsignal({
key: "YOUR FRONTEND API KEY",
});
(It's recommended (although not necessarily required) to use the instance of the Appsignal
object like a singleton. To do this, export
the client from the appsignal.js
file.)
You can then import and use the object in your app:
// index.js
// Place this at the top
import { appsignal } from "./appsignal"; // Update to the location used in the previous step
// Place your app code below this
Support for CDNs
Currently, we have no plans to supply a CDN-hosted version of this library.
Uninstall
Uninstall AppSignal from your app by following the steps below. When these steps are completed your app will no longer send data to the AppSignal servers.
-
In the
package.json
of your app, delete all lines referencing anappsignal
package:"*appsignal/*": "*"
. -
Run
npm install
oryarn install
to update yourpackage.lock
/yarn.lock
with the removed packages state.- Alternatively, run
npm uninstall @appsignal/<package name>
oryarn remove @appsignal/<package name>
to uninstall an AppSignal package.
- Alternatively, run
-
Remove any AppSignal configuration from your app.
-
Commit, deploy and restart your app.
- This will make sure the AppSignal servers won't continue to receive data from your app.
-
Finally, remove the app on AppSignal.com.