# @attacksimulator/events

> This package can be used to enable events collection on a landing page and send them back to ATTACK Simulator.

Latest version **1.3.0** (published 2026-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @attacksimulator/events
pnpm add @attacksimulator/events
yarn add @attacksimulator/events
bun add @attacksimulator/events
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2026-07-31 |
| First published | 2022-02-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 0 |
| Author | ATTACK Simulator |
| Maintainers | attacksimulator |

## Links

- npm: https://www.npmjs.com/package/@attacksimulator/events
- Repository: https://github.com/ATTACKSimulator/events
- Homepage: https://attacksimulator.com
- Issues: https://github.com/ATTACKSimulator/events/issues
- npm.io page: https://npm.io/package/@attacksimulator/events

## Dependencies (1)

- [ua-parser-js](https://npm.io/package/ua-parser-js.md) ^2.0.10

## Recent versions

- 1.3.0 (latest) — 2026-07-31
- 1.2.15 — 2026-06-17
- 1.2.14 — 2026-06-16
- 1.2.13 — 2026-03-04
- 1.2.12 — 2025-10-30
- 1.2.11 — 2024-12-28
- 1.2.10 — 2024-12-28
- 1.2.9 — 2024-12-28
- 1.2.8 — 2024-12-28
- 1.2.7 — 2024-12-28
- 1.2.6 — 2024-06-27
- 1.2.5 — 2024-06-27
- 1.2.4 — 2024-06-27
- 1.2.3 — 2024-06-27
- 1.2.2 — 2023-08-04
- … 17 more at https://npm.io/package/@attacksimulator/events/versions

## README

# ATTACK Simulator Events

This library helps our clients collect events from their custom landing pages and send them to our API.

## Instalation

Events was designed to work both in the browser and in Node.js.

### Node.js

To get started with Events in your Node.js project, simply add the dependency with NPM.

```console
npm i @attacksimulator/events --save
```

### Browser

Include the `bundle.min.js` file in your project.

```html
<script src="path/to/events/bundle.min.js"></script>
```

#### CDN

The events package can be included by way of a CDN provider like cdnjs.com, unpkg and jsDelivr ...

```html
<script src="https://cdn.jsdelivr.net/npm/@attacksimulator/events@1.2.2/dist/bundle.min.js"></script>
```

## Usage

Before running the plugin, make sure you get an api key from our support team.

```html
<script>
  const ev = new ATSEvents({ apiKey: "YOUR_API_KEY" });
  ev.listen();
</script>
```

## Options

| Name                | Type       | Description                                                                                                               |
|---------------------| ---------- |---------------------------------------------------------------------------------------------------------------------------|
| **apiKey**          | `string`   | The key required to access our api. You can get it by contacting our support team.                                        |
| **eventsToInclude** | `string[]` | Set the events to watch. Leave empty to watch all available events. The default value is `[]`.                            |
| **eventsToExclude** | `string[]` | Set the events to not watch. Leave empty to watch all available events. The default value is `[]`.                        |
| **debug**           | `boolean`  | Set debugging `true` of `false`. The default value is `false`.                                                            |
| **shouldRedirect**  | `boolean`  | Specify whether the page should redirect after `click` or `submit` events. The default value is `true`.                   |
| **redirectUrl**     | `string`   | Set the redirect url after affecting events have been triggered. The default value is `https://tips.attacksimulator.com`. |
| **source**          | `string`   | Set the source of the events. Supported values are `LP` or `LP_EDU`. The default value is `LP`.                           |
| **url**             | `string`   | The destination url that the events should be sent at                                                                     |
| **extraPayload**    | `object`   | An object with extra data to be sent with the events.                                                                     |

## Available events

| Name                      | Type              | Description                                                                                                                                                                         |
| ------------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **attachment_opened**     | internal          | The event gets triggered automatically when an attachment is opened. This requires the url of the host page to have a `file_type=attachment` query string.                          |
| **button_clicked**        | user+redirect     | The event gets triggered when a user clicks on a link that does not point to a file. After this event is sent, the webpage will redirect to `redirectUrl`.                          |
| **download_file_event**   | user              | The event gets triggered when a user clicks on a link that does point to a file.                                                                                                    |
| **file_opened**           | internal          | The event gets triggered automatically when an attachment is opened. This requires the url of the host page to have a `file_type=download` query string.                            |
| **input_filled**          | user              | The event gets triggered once per input field when a user enters a non-empty value. Later changes to the same field are ignored.                                                     |
| **page_loaded**           | internal          | The events triggers automatically whenever the page is loaded.                                                                                                                      |
| **page_read**             | internal          | The event gets triggered automatically whenever a user stays on the page for at least 30 seconds. This event is useful for educational pages.                                       |
| **form_submitted**        | user + redirect   | The events is triggered when a user submits a form. After this event is sent, the webpage will redirect to `redirectUrl`.                                                           |
| **mic_accepted**          | manual + redirect | The events is triggered manually and should be run after a user accepts the microphone permissions prompt. After this event is sent, the webpage will redirect to `redirectUrl`.    |
| **webcam_accepted**       | manual + redirect | The events is triggered manually and should be run after a user accepts the webcam permissions prompt. After this event is sent, the webpage will redirect to `redirectUrl`.        |
| **location_accepted**     | manual + redirect | The events is triggered manually and should be run after a user accepts the location permissions prompt. After this event is sent, the webpage will redirect to `redirectUrl`.      |
| **notification_accepted** | manual + redirect | The events is triggered manually and should be run after a user accepts the notifications permissions prompt. After this event is sent, the webpage will redirect to `redirectUrl`. |
| **clipboard_accepted**    | manual + redirect | The events is triggered manually and should be run after a user accepts the clipboard permissions prompt. After this event is sent, the webpage will redirect to `redirectUrl`.     |

---
_Source: https://npm.io/package/@attacksimulator/events · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
