Configuration API Reference

The AdUnblock Configuration API provides access to the latest JavaScript configuration files needed for ad blocker detection on your website.

Base URL

http://config.adunblocker.com

Authentication

This API endpoint is publicly accessible and does not require authentication.

Caching

The API responses are cached for optimal performance and support standard HTTP caching headers for efficient client-side caching.

Server Tag Configuration

Get JavaScript Configuration

Retrieve the latest JavaScript files needed for ad blocker detection.
curl -X GET http://config.adunblocker.com/server-tag.json

Response

{
  "js": ["https://cdn.example.com/detection-script.js"]
}

Response Fields

FieldTypeDescription
jsarrayArray of JavaScript file URLs for ad blocker detection

Response Headers

HeaderDescription
Content-Typeapplication/json
ETagEntity tag for caching validation
Last-ModifiedTimestamp when the configuration was last updated

Usage Example

Once you fetch the configuration, you can dynamically load the JavaScript files:
// Fetch configuration
const config = await fetch(
  "http://config.adunblocker.com/server-tag.json"
).then((response) => response.json());

// Load the JavaScript files
config.js.forEach((scriptUrl) => {
  const script = document.createElement("script");
  script.src = scriptUrl;
  script.async = true;
  document.head.appendChild(script);
});

Caching Recommendations

  • The API supports standard HTTP caching headers
  • Implement conditional requests using If-None-Match header with ETag
  • Cache responses locally for better performance
  • Check for updates periodically (e.g., every hour)
// Example with conditional request
const etag = localStorage.getItem("config-etag");
const headers = etag ? { "If-None-Match": etag } : {};

const response = await fetch("http://config.adunblocker.com/server-tag.json", {
  headers,
});

if (response.status === 304) {
  // Use cached configuration
  console.log("Configuration unchanged");
} else {
  // Update cache
  const config = await response.json();
  localStorage.setItem("config-etag", response.headers.get("ETag"));
  localStorage.setItem("config-data", JSON.stringify(config));
}

Valid Script Sources (Deprecated)

This endpoint is deprecated and will be removed in a future version. Please use the /server-tag.json endpoint instead.

Get Valid Script Sources

Retrieve a list of valid JavaScript source URLs for ad blocker detection.
curl -X GET https://config.adunblocker.com/valid_script_sources.json

Response

["https://cdn.example.com/detection-script.js"]

Response Format

The response is a JSON array containing valid JavaScript source URLs as strings.

Response Headers

HeaderDescription
Content-Typeapplication/json
ETagEntity tag for caching validation
Last-ModifiedTimestamp when the configuration was last updated

Migration Guide

If you’re currently using this endpoint, migrate to the new /server-tag.json endpoint:
// Old (deprecated)
const sources = await fetch(
  "https://config.adunblocker.com/valid_script_sources.json"
).then((response) => response.json());

// New (recommended)
const config = await fetch(
  "http://config.adunblocker.com/server-tag.json"
).then((response) => response.json());
const sources = config.js;