# Deno

### Installation <a href="#installation" id="installation"></a>

```javascript
// Deno's Node.js compatibility mode
import { LogSnag } from 'npm:@logsnag/node';
```

```javascript
// Directly from the CDN.
import { LogSnag } from 'https://dev.jspm.io/@logsnag/node';
```

### Usage <a href="#user-content-usage" id="user-content-usage"></a>

```javascript
const logsnag = new LogSnag({
  token: '<TOKEN>',
  project: '<PROJECT_NAME>'
});

// Track an event
await logsnag.track({
  channel: "payments",
  event: "New Subscription",
  user_id: "user-123",
  icon: "💰",
  notify: true,
  tags: {
    plan: "premium",
    cycle: "monthly",
    trial: false
  }
});

// Identify user traits (e.g. name, email, plan, etc.)
await logsnag.identify({
  user_id: "user-123",
  properties: {
    name: "John Doe",
    email: "john@doe.com",
    plan: "premium",
  }
});

// Track an insight
await logsnag.insight.track({
  title: "User Count",
  value: "100",
  icon: "👨",
});

// Increment an insight value
await logsnag.insight.increment({
  title: "User Count",
  value: 1,
  icon: "👨",
});
```

### Disabling Tracking <a href="#user-content-disabling-tracking" id="user-content-disabling-tracking"></a>

You can disable tracking for development purposes by using the `disableTracking` method:

```
logsnag.disableTracking();
```

And enable it back with:

```
logsnag.enableTracking();
```

You can check if tracking is disabled with:

```
logsnag.isTrackingDisabled();
```

### Methods <a href="#user-content-methods" id="user-content-methods"></a>

* `track(options: TrackOptions): Promise<boolean>`: Track custom events.
* `identify(options: IdentifyOptions): Promise<boolean>`: Identify user traits.
* `group(options: GroupOptions): Promise<boolean>`: Group users.
* `insightTrack(options: InsightTrackOptions): Promise<boolean>`: Track insights.
* `insightIncrement(options: InsightIncrementOptions): Promise<boolean>`: Increment insight values.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.logsnag.com/sdks/deno.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
