# JS Code

### Add customId to your subscribers

Add the code below to your HTML DOM Tree

```html
<var id="ppg-custom-id" data-id="your id here"></var>
```

### Fetch subscriber ID after register

Our standard integration code allows to register callback for **syncId** event.

When subscribers "subscribe" you can receive ID without usage of our SDK

```html
<script>
window.ppg = window.ppg || {};
window.ppg.register = window.ppg.register || [];
window.ppg.register.push(['syncId', subscriberId => console.log("Your SubscriberID:", subscriberId)]);
</script>
```

### Switch for subscribe action instead of popup

It's possible to do that just add `<input>` with type checkbox and `id="ppg-switch"`.

```html
<input type="checkbox" id="ppg-switch" disabled="disabled"/>
```

{% hint style="info" %}
You can hide popup by setting "delay popup time" to 999999s
{% endhint %}

Example code of toggle usage with styles you can see at: <https://github.com/ppgco/examples/tree/master/sdk_toggle>


---

# 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.pushpushgo.company/web-push/js-code.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.
