Repository navigation
Releases: yuuues/myadserver-sdk-react
Releases · yuuues/myadserver-sdk-react
Release list
v2.0.4
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. renderUrlfield onAdResponseandAdApiResponse.
Changed
- Iframe strategy: When
renderUrlis available (default), the iframe loads the signed server URL (CSP controlled server-side). Falls back to sandboxeddata:URI when no render URL is present.
v2.0.3
Changed
- Switch from
srcdoctodata:URI:srcdocinherits 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
Changed
- Iframe sandbox hardened: Removed
allow-same-originfrom sandbox attribute, giving script ads an opaque origin for stronger isolation. - Switched to
srcdoc: Script injection now usesiframe.srcdocinstead ofdoc.open()/doc.write()/doc.close()for cleaner, more reliable content loading.
v2.0.1
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
widthandheightfrom the API response.
v2.0.0 - Script Ads Support
Breaking Changes
AdResponse.imageUrlchanged fromstringtostring | undefinedAdResponse.destinationUrlchanged fromstringtostring | undefined
New Features
- Script ad support:
AdUnitnow renders third-party script-based ads (ad network tags) automatically. The ad server decides the type; no client-side configuration needed. typefield ('image' | 'script') onAdResponsescriptContentfield onAdResponsefor script ads- Support for flat API response format alongside the wrapped format
widthandheightfields now included in API responses
Fixes
- Fixed query parameter: SDK now sends
zone_slug(matching the backend) instead ofzone
Full Changelog
See CHANGELOG.md
v1.0.0
Added
AdClient— framework-agnostic HTTP client for the Ad Server API.AdProvider/useAdClient/useAdContext— React context for configuration.useAdhook — fetch and manage ad data with loading/error states.usePrefetchAdhook — warm cache without rendering.AdUnitcomponent — display ads with automatic impression and click tracking.- IntersectionObserver-based impression tracking.
sendBeaconwith fetch fallback for reliable tracking.- Support for uploaded images and external image URLs.
- Separate
@yuuues/myadserver-sdk-react/coreentry point for non-React usage. - ESM and CommonJS builds with TypeScript declarations.