Insightcn

capturePrivateRegistryEvent

Track an event without validation.

Track an event without validation (skips path/user-agent checks).

Signature

function capturePrivateRegistryEvent(
  request: Request,
  token: string,
  type?: "installed" | "viewed" | "downloaded",
  config?: InsightcnConfig
): Promise<void>;

Parameters

ParameterTypeDefaultDescription
requestRequest-The incoming HTTP request
tokenstring-Your registry API key
typestring"installed"Event type: "installed", "viewed", or "downloaded"
configobject{}Optional configuration override

Config Options

PropertyTypeDescription
apiUrlstringOverride default API URL

Example

import { capturePrivateRegistryEvent } from "@insightcn/sdk";

const request = new Request("https://your-registry.com/r/ui/button.json", {
  method: "GET",
  headers: { "user-agent": "node-fetch" },
});

// Track without validation
await capturePrivateRegistryEvent(request, "your-api-key", "installed");

When to Use

Use capturePrivateRegistryEvent when:

  • Tracking internal events that don't come from HTTP requests
  • Testing event tracking in development
  • You need to bypass validation for special cases

Differences from captureRegistryEvent

FeaturecaptureRegistryEventcapturePrivateRegistryEvent
Path validationYesNo
User-agent checkYesNo
IP extractionYesYes
Event storageYesYes

On this page