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
With npm or yarn
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 @appsignal/javascript
With JSPM.dev
Thanks to the JSPM CDN, it is possible to use the AppSignal for JavaScript integration without a front-end asset build step. Your application can import packages directly from the CDN:
import Appsignal from "https://jspm.dev/@appsignal/javascript";
With JSPM.io import maps
Using the JSPM.io import map generator, you can generate an import map for your application's dependencies.
Add @appsignal/javascript
to the dependencies list, then add the generated import map and ES module shims to your application's code.
With rails-importmap
Use the following command to add these packages to your Rails application's import maps:
./bin/importmap pin @appsignal/javascript
Usage
Create an appsignal.js
file to require and configure AppSignal. From this file, we export the instance of the Appsignal
object that we will use from our application. For more information about the configuration, see our configuration section.
// appsignal.js // For ES Module via npm/yarn, or with import maps import Appsignal from "@appsignal/javascript"; // For CommonJS module via npm/yarn const Appsignal = require("@appsignal/javascript").default; // With the JSPM.dev CDN import Appsignal from "https://jspm.dev/@appsignal/javascript"; export const appsignal = new Appsignal({ key: "YOUR FRONTEND API KEY", });
You can then import and use the Appsignal
object in your app:
// Place this at the top // Import the file created in the previous step import { appsignal } from "./appsignal"; // Place your app code below this
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.