# Push

> Handles push notification permission and interaction tracking for Segmentify push campaigns.

Handles push notification permission and interaction tracking for Segmentify push campaigns. These events must be sent when a user arrives on your site via a push campaign link where `utm_medium=push`.

Before sending these events, verify that the campaign URL contains the required UTM parameters: `utm_source=segmentify`, `utm_medium=push`, and `utm_campaign=pushCampaignName`.

**Requests:**
- **Accept Notifications** — registers the user's push subscription with Segmentify's push service (`psh2.segmentify.com`). Sends the browser `instanceId` to associate the subscription with the user.
- **Deny Notifications** — records the user's decision to deny push notifications. Sent to `gimli-eu.segmentify.com` as a GET request with `userId`, `instanceId`, `browser`, and `device` as query parameters.
- **Native Push Permission** — registers a native push permission event via `psh2.segmentify.com/native/subscription/push`. Used for native app or browser-level push opt-in flows.
- **Native View Interaction** — fires when a user views content after arriving from a push notification (`type: "view"`). Sent to `psh2.segmentify.com/native/interaction/notification`.
- **Native Click Interaction** — fires when a user clicks on a push notification (`type: "click"`). Sent to `psh2.segmentify.com/native/interaction/notification`.

## Push Permission

`POST /native/subscription/push`

**Example body**

```json
{
  "deviceToken": "FCM_DEVICE_TOKEN",
  "type": "PERMISSION_INFO",
  "providerType": "FIREBASE",
  "userId": "1234567890123456789",
  "device": "PC",
  "os": "ANDROID",
  "email": "user@example.com"
}
```

See this endpoint in the [Events API reference](/reference/events/).

## Native View Interaction

`POST /native/interaction/notification`

**Example body**

```json
{
  "os": "IOS",
  "device": "PC",
  "type": "VIEW",
  "instanceId": "psh_xxxx",
  "userId": "1234567890123456789",
  "providerType": "FIREBASE"
}
```

See this endpoint in the [Events API reference](/reference/events/).

## Native Click Interaction

`POST /native/interaction/notification`

**Example body**

```json
{
  "os": "PC",
  "device": "PC",
  "type": "CLICK",
  "instanceId": "psh_xxxx",
  "userId": "1234567890123456789",
  "providerType": "FIREBASE"
}
```

See this endpoint in the [Events API reference](/reference/events/).

## Accept Notifications

`POST /subscription/push`

**Example body**

```json
{
  "subscriptionId": "PUSH_SUBSCRIPTION_ID",
  "auth": "PUSH_AUTH_SECRET",
  "key": "PUSH_P256DH_KEY",
  "userId": "1234567890123456789",
  "agent": "ANDROID",
  "endpoint": "https://fcm.googleapis.com/fcm/send",
  "deviceType": "ANDROID",
  "isVapid": false,
  "fcmToken": "FCM_DEVICE_TOKEN"
}
```

See this endpoint in the [Events API reference](/reference/events/).

## Deny Notifications

`GET /subscription/deny`

See this endpoint in the [Events API reference](/reference/events/).
