Content Security Policy (CSP)
Who is this for: developers adding MomentScience products to a website or app that enforces a strict Content Security Policy.
Outcome: every MomentScience domain is allowed under the right CSP directive, so the SDK, offer creatives, fonts, styles and tracking load without being blocked.
Overview
Perkswall, Moments and our other native offer experiences load scripts, styles, fonts, images and iframes from a small set of MomentScience domains. They also call our APIs and send tracking events. If your site blocks external resources by default, the browser will refuse any of these requests that your policy does not allow, and offers will fail to load or will render without styling.
Add the domains below to the matching directives in your policy. If you already use default-src, these entries go in the specific directives, which override it.
Required domains by directive
script-src
The SDK loader, the SDK itself, and the scripts it loads on demand:
https://cdn.pubtailer.com
https://cdn.adspostx.com
https://sdk-js.pubtailer.com
https://naojs.pubtailer.com
https://trk.pubtailer.com
https://trk-e.pubtailer.com
https://e.pubtailer.comcdn.adspostx.com is needed if your integration snippet loads launcher.min.js from that host. Older snippets do.
If your policy uses script-src-elem, add the same list there as well. Safari versions before 15.4 do not support script-src-elem, so keep script-src in place either way.
style-src
Stylesheets for Moments and Perkswall, plus Google Fonts CSS:
'unsafe-inline'
https://cdn.pubtailer.com
https://cdn.adspostx.com
https://naojs.pubtailer.com
https://trk.pubtailer.com
https://trk-e.pubtailer.com
https://e.pubtailer.com
https://api.adspostx.com
https://fonts.googleapis.comThe SDK injects <style> elements at runtime to style offer units. Without 'unsafe-inline' (or the style-src-elem equivalent) those styles are blocked and offers render unstyled. The SDK does not currently support a style nonce.
fonts.googleapis.com belongs here because it serves CSS. The SDK adds a <link rel="stylesheet"> to it when an offer unit uses a Google Font.
If your policy uses style-src-elem, add the same list there too.
font-src
Font files used by MomentScience experiences:
https://cdn.pubtailer.com
https://adpx.b-cdn.net
https://fonts.gstatic.comimg-src
Offer creatives, icons and tracking pixels:
https://api.adspostx.com
https://cdn.pubtailer.com
https://adpx.b-cdn.net
https://trk.pubtailer.com
https://trk-e.pubtailer.com
https://e.pubtailer.comSome offers carry an advertiser tracking pixel that loads from the advertiser's own domain. Those domains vary by offer and cannot be listed in advance. If your img-src is restricted to the list above, advertiser pixels will be blocked. The offer still displays, but the advertiser may not record the impression.
connect-src
API calls, event tracking and offer delivery. The SDK sends some events with navigator.sendBeacon, which is also governed by this directive.
https://api.adspostx.com
https://trk.adspostx.com
https://trk.pubtailer.com
https://trk-e.pubtailer.com
https://e.pubtailer.com
https://api.perkswallet.comframe-src
Embedded Perkswall and offerwall views:
https://cdn.pubtailer.com
https://get.perkswall.com
https://naojs.pubtailer.comSituational domains
You only need these if the situation applies to your account. Your MomentScience contact can tell you which ones do.
https://cdn-alt.pubtailer.com in script-src, style-src, font-src and img-src. Needed when your integration sets useAltCdn: true in AdpxConfig.
https://cdn-alt-assets.pubtailer.com in img-src. Needed when your account is configured to serve creatives from the alternate asset CDN.
https://integration-success.momentscience.com in img-src and connect-src. Needed while you test with dev mode turned on, because tracking in dev mode goes to this host instead of the production tracking domains.
Your custom tracking domain in img-src, connect-src and script-src. Needed when your account uses a custom tracking domain (for example trk.yourdomain.com). It replaces the trk domains for impressions, clicks and beacons.
If you add your own scripts to a custom offer unit template, those scripts run on your page. Any third-party domain they load from needs its own entry in your policy.
Directives you do not need to list domains in
script-src-attr and style-src-attr only control inline event handlers and inline style="" attributes. The browser ignores domains listed under them, so there is nothing to add there.
Example policy
A complete policy for a standard Moments or Perkswall integration. Merge these values into your existing directives rather than replacing them.
Content-Security-Policy:
script-src https://cdn.pubtailer.com https://cdn.adspostx.com https://sdk-js.pubtailer.com https://naojs.pubtailer.com https://trk.pubtailer.com https://trk-e.pubtailer.com https://e.pubtailer.com;
style-src 'unsafe-inline' https://cdn.pubtailer.com https://cdn.adspostx.com https://naojs.pubtailer.com https://trk.pubtailer.com https://trk-e.pubtailer.com https://e.pubtailer.com https://api.adspostx.com https://fonts.googleapis.com;
font-src https://cdn.pubtailer.com https://adpx.b-cdn.net https://fonts.gstatic.com;
img-src https://api.adspostx.com https://cdn.pubtailer.com https://adpx.b-cdn.net https://trk.pubtailer.com https://trk-e.pubtailer.com https://e.pubtailer.com;
connect-src https://api.adspostx.com https://trk.adspostx.com https://trk.pubtailer.com https://trk-e.pubtailer.com https://e.pubtailer.com https://api.perkswallet.com;
frame-src https://cdn.pubtailer.com https://get.perkswall.com https://naojs.pubtailer.com;To check your policy, open your browser's developer console on a page with offers. Any blocked request shows up as a CSP violation that names the directive and the domain.
If you run into issues during integration, contact us at [email protected].