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 guide assumes that you have already integrated and initialized the SDK. If not, refer to the SDK introduction.

Overview

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

Usage

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

getWebExtensionSdkInstance().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