AdSpirit Integration
AdSpirit is a trusted ad platform for premium publishers. This guide will cover the key setup steps, configuration options, and best practices to ensure a smooth and compliant integration.
Before starting the integration, ensure you have the following resources ready:
- AdSpirit script url: proper script url (usually it is default for all: https://cdn.adspirit.de/adasync.min.js)
- List of ads and there corresponding placements for desktop and mobile in design
- Consent Management: Ensure the CMP (Consent Management Platform) is configured with vendors relevant to AdSpirit (including IAB-compliant vendor IDs): "cdn.adspirit.de", "apoverlag.adspirit.de".
- Use PXP version 3.8.8 and higher
Important Notes:
- AdSpirit ads can be tested even at localhost without any additional queryparams or configuration
- We don't need to trigger any consent given event, while AdSpirit reads it on their side
- AdSpirit require adsRefresh
- Some customers use subscribtion plans to disable ads
- !!! If conditional loading of ads for proper screens needed we need to have conditional loading in view.json relying on $context.device_type and not a css based condition with display: block/none
- Go to Experience Builder. Create or edit experience config default/storefront/assets/experience.config.json
- As AdSpirit manages consent on their side we don't need to add additional consent configuration to purple.ads.consent (for other ad services, which is not audienzz you might need to add vendorId and iabVendorId. You find vendorId in your consent manager configurations and find iabVendorId here https://iabeurope.eu/vendor-list-tcf/)
- In ads.adspirit.configuration add proper script id adspirit-header-script and url https://cdn.adspirit.de/adasync.min.js.
- To refresh AdSpirit ads dynamically, we need access to the loaded AdSpirit script.
- AdSpirit provides its API via asm_async_data, which is a standard global object after the script loads.
- We must pass asm_async_data as the scriptWinKey to reference it correctly.
- To hide ads for subscribed users, we need to check for a specific window key that indicates whether the user is a premium subscriber.
- The window key varies by project.
- In the latest project, this key is cmp_pur_loggedin.
- If window[cmp_pur_loggedin] is true, ads should not be shown.
{ "language": "de", "purple": { "version": { "major": 1, "minor": 0 }, "ads": { "adspirit": { "configuration": { "headerScriptId": "adspirit-header-script", "headerScriptUrl": "https://cdn.adspirit.de/adasync.min.js", "scriptWinKey": "asm_async_data", "premiumSubWinKey": "cmp_pur_loggedin"
} } } } }

{ "adSlots": [ { "id": "adspirit-desktop-superbanner-272", "providerConfig": { "id": "272", "type": "ADSPIRIT", "height": 110, "params": "$function.customChecker($context.adSpiritParams)", "platform": "desktop", "spaceTop": 2, "width": 1058, "spaceBottom": 1 },
{ "id": "adspirit-mobile-header-270", "providerConfig": { "id": "272", "type": "ADSPIRIT", "params": "$function.customChecker($context.adSpiritParams)", "platform": "mobile tablet", "spaceTop": 2, "spaceBottom": 1 } } } ] }
- top level id can be anything specific to project.
- params resides in content.properties["adspirit.urlparameters"] coming from hub, should be set in builder as $context.adSpiritParams. In url.resolver.json it can be set per article, and not per home page for example, so to properly handle this use some $function.customChecker($context.adSpiritParams) to resolve to empty string if there is no $context.adSpiritParams defined. Example of setting of those adSpiritParams in url.resolver.json:
NOTE: This section is just to see what will be our resulted add from above configurations (no configurations part here) With crossed items to be configurable:
1) mobile tablet - platform (it could be "desktop", "mobile", "tablet", "large-desktop" or combined "mobile tablet") if configured in .scss file (check adspirit.scss file mentioned below). This classes should not be used for conditional showing of the ads with display: block/none.
2) space-top-1 space-bottom-2 - configurations are also added in scss file for proper styling (check adspirit.scss file mentioned below)
3) pid=12345 - id of the ad. Proper ads and their ids can be found here
4) param1=value1 - could be something like "special=no_ad" and should be configured through builder and placed in from content.properties["adspirit.urlparameters"] to $context.adSpiritUrlParams or something similar. Can be added with or without "&" at the beginning of the string, other params add should match "&" structure in between of each query param "special=no_ad¶m1=value1".
5) styles width: 300px & height: auto - width and height if not provided will be 100% and auto respectevely. You should set them as number without px.


We should use conditional loading of mobile/tablet or desktop ads (check if project handles proper screen types like $context.device_type):
You can apply your ad specific styles like this: /src/default/storefront/assets/scss/adspirit.scss
- Native Ads are currently not covered in Pxp code
- Swiper Ads are not covered in Pxp code