Skip to main content
Sleek’s Web Extension SDK can detect affiliate activations in a browser tab and emit events when such activity is observed. These events help you track engagement, trigger UI changes, or log activity for analytics purposes.
This document assumes that you have already integrated the Sleek web extension SDK into your extension. If you haven’t, please refer to the Web Extension SDK integration guide.

Overview

Affiliate activations are detected when the user visits or navigates to a URL that contains affiliate tracking parameters. When this happens, the web extension SDK emits an AFFILIATE_ACTIVATION_DETECTED event with details. You can listen to this event using registerEventListener().

Usage

import { getWebExtSdk } from "@sleek/web-ext-sdk";

getWebExtSdk().registerEventListener((event, tabDetails) => {
  if (event.type === "AFFILIATE_ACTIVATION_DETECTED") {
    console.log("Affiliate detected", event.data, tabDetails);
  }
});

Event Payload

interface AffiliateActivationDetectedEvent {
  type: "AFFILIATE_ACTIVATION_DETECTED";
  data: {
    detectedUrl: string;
    detectedUrlCapturedOn: number; // Unix timestamp
    finalUrl: string;
    finalUrlCapturedOn: number; // Unix timestamp
  };
}
The event contains:
  • detectedUrl: The affiliate-tracked URL
  • detectedUrlCapturedOn: Timestamp when affiliate URL was detected
  • finalUrl: Destination URL after redirection
  • finalUrlCapturedOn: Timestamp when final URL was confirmed