Skip to content

Track Event ​

Track feature usage, user behavior, and deactivation reasons from your product.

POST /public/v1/event

Request ​

json
{
  "public_key": "pk_your_public_key",
  "event": "feature_used",
  "properties": {
    "feature": "export",
    "format": "csv"
  },
  "license_key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
  "site": "customer.example.com"
}
FieldTypeRequiredDescription
public_keystringYesYour product's public key
eventstringYesEvent name (see below)
propertiesobjectNoEvent-specific data
license_keystringNoAttribute event to a customer license
sitestringNoDomain identifier; defaults to client hostname

Common Events ​

EventDescriptionProperties
feature_usedUser used a feature{ feature: "export", format: "pdf" }
product.installedPlugin/product installed{ env: { php, wp, … }, plugins: [...] } — see Install Tracking
product.uninstalledPlugin/product uninstalled{ reason, feedback, env: { ... } } — see Install Tracking
settings_changedSettings modified{ setting: "theme", value: "dark" }
error_occurredError happened{ code: "E001", message: "..." }

Event names that start with license., update., release., product., or site. are reserved by PackEdge for internal events and won't appear in the Feature Usage dashboard. Pick anything else.

Response ​

json
{
  "success": true
}

JS SDK ​

The simplest path is the official package — see the JavaScript SDK docs for installation, the full API surface, and event-naming conventions.

bash
npm install @packedgedev/sdk
javascript
import packedge from '@packedgedev/sdk';

packedge.init('pk_your_public_key', {
  licenseKey: 'MYPLUGIN-XXXX-XXXX-XXXX-XXXX', // optional
});

packedge.track('feature_used', {
  feature: 'export',
  format: 'pdf',
});

The SDK uses navigator.sendBeacon when available, falls back to fetch(..., { keepalive: true }), and never throws — safe to call from your customers' browsers.

<script> tag ​

html
<script src="https://unpkg.com/@packedgedev/sdk/dist/index.global.js"></script>
<script>
  packedge.init('pk_your_public_key');
  packedge.track('feature_used', { feature: 'export' });
</script>

REST (no build step) ​

If you can't pull a JS package — e.g. inside a WordPress plugin — POST directly. Set blocking: false / keepalive: true so analytics never slow your app down.

JavaScript ​

javascript
fetch('https://api.packedge.dev/public/v1/event', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  keepalive: true,
  body: JSON.stringify({
    public_key: 'pk_your_public_key',
    event: 'feature_used',
    properties: { feature: 'export' },
  }),
});

PHP (WordPress) ​

php
wp_remote_post('https://api.packedge.dev/public/v1/event', [
  'body' => json_encode([
    'public_key' => 'pk_your_public_key',
    'event'      => 'feature_used',
    'license_key'=> $license_key,
    'site'       => parse_url(home_url(), PHP_URL_HOST),
    'properties' => ['feature' => 'export'],
  ]),
  'headers'  => ['Content-Type' => 'application/json'],
  'blocking' => false,
]);

Viewing analytics ​

Events show up in the PackEdge Console under each product's Analytics → Feature Usage tab:

  • Per-feature cards with sparklines and period-over-period deltas
  • Adoption rate (unique licenses ÷ active licenses)
  • Day-of-week × hour usage heatmap
  • Quiet/abandoned features
  • Top licenses and domains

Privacy ​

  • Events are anonymous by default — no PII required.
  • Pass license_key to attribute usage to a customer.
  • Respect user consent before tracking.