Skip to content

Releases: yuuues/myadserver-sdk-react

v2.0.4

Choose a tag to compare

@yuuues yuuues released this 12 Mar 23:00

Added

  • Signed render URL: Script ads now load via a server-rendered URL (renderUrl) with a short-lived HMAC token. The API key never appears in iframe URLs or browser logs.
  • renderUrl field on AdResponse and AdApiResponse.

Changed

  • Iframe strategy: When renderUrl is available (default), the iframe loads the signed server URL (CSP controlled server-side). Falls back to sandboxed data: URI when no render URL is present.

v2.0.3

Choose a tag to compare

@yuuues yuuues released this 12 Mar 22:37

Changed

  • Switch from srcdoc to data: URI: srcdoc inherits the parent page's CSP (per spec), which can block external scripts from ad networks. data: URIs create an opaque origin with no inherited CSP, allowing ad scripts to load resources freely.
  • Simplified sandbox: Reduced to allow-scripts allow-popups.

v2.0.2

Choose a tag to compare

@yuuues yuuues released this 12 Mar 22:27

Changed

  • Iframe sandbox hardened: Removed allow-same-origin from sandbox attribute, giving script ads an opaque origin for stronger isolation.
  • Switched to srcdoc: Script injection now uses iframe.srcdoc instead of doc.open()/doc.write()/doc.close() for cleaner, more reliable content loading.

v2.0.1

Choose a tag to compare

@yuuues yuuues released this 12 Mar 21:51

Fixed

  • Script ad injection: Replaced direct DOM script injection with iframe-based approach. Ad networks that use document.write() now work correctly, as iframes provide the fresh document context they require.
  • Script container now respects width and height from the API response.

v2.0.0 - Script Ads Support

Choose a tag to compare

@yuuues yuuues released this 12 Mar 09:52

Breaking Changes

  • AdResponse.imageUrl changed from string to string | undefined
  • AdResponse.destinationUrl changed from string to string | undefined

New Features

  • Script ad support: AdUnit now renders third-party script-based ads (ad network tags) automatically. The ad server decides the type; no client-side configuration needed.
  • type field ('image' | 'script') on AdResponse
  • scriptContent field on AdResponse for script ads
  • Support for flat API response format alongside the wrapped format
  • width and height fields now included in API responses

Fixes

  • Fixed query parameter: SDK now sends zone_slug (matching the backend) instead of zone

Full Changelog

See CHANGELOG.md

v1.0.0

Choose a tag to compare

@yuuues yuuues released this 12 Mar 09:47

Added

  • AdClient — framework-agnostic HTTP client for the Ad Server API.
  • AdProvider / useAdClient / useAdContext — React context for configuration.
  • useAd hook — fetch and manage ad data with loading/error states.
  • usePrefetchAd hook — warm cache without rendering.
  • AdUnit component — display ads with automatic impression and click tracking.
  • IntersectionObserver-based impression tracking.
  • sendBeacon with fetch fallback for reliable tracking.
  • Support for uploaded images and external image URLs.
  • Separate @yuuues/myadserver-sdk-react/core entry point for non-React usage.
  • ESM and CommonJS builds with TypeScript declarations.