Skip to documentation content
CookieBeam

Environments and publishing

Publish banner snapshots to separate environments and choose the correct CDN bundle for each site.

Last updated:

Each banner has a production environment. You can add other environments for testing or staged releases.

Creating a non-production environment, and publishing or promoting to one, needs the Non-production environments feature, included from the Starter plan. Publishing to production does not.

An environment stores its slug, production status, published version, and last publish time. Only one environment can be marked as production for a banner.

Manage environments

Open the banner's deployment controls to list its environments. Creating or deleting an environment requires Admin permission for the Banners section. The production environment cannot be deleted.

Environment slugs use lowercase letters, numbers, and hyphens. A slug cannot start or end with a hyphen.

Deleting an environment also removes its published files from the CDN.

New environments do not have a published version. Until the environment has a successfully built version, the dashboard returns the default bundle URLs for that environment. This avoids handing you an environment URL that has no stored asset.

Publish a snapshot

Publishing to an environment creates a new immutable version from the current banner configuration. When the publish succeeds, the environment points to that version.

Publishing requires Publish permission for the Banners section and publish access to the selected banner. It is not limited to team owners or administrators.

A publish can stop when the selected compliance mode conflicts with the blocking configuration. Review the mismatch before choosing whether to acknowledge it and continue.

What a publish does, in order

  1. CookieBeam saves the new version with the build status pending. Nothing points to it yet.
  2. It builds every file for the target environment.
  3. It keeps a copy of the files currently on the CDN, then uploads the new ones.
  4. Only then does it move the environment to the new version and mark the version built. For the production environment, the banner's current published version moves in the same step.
  5. It clears the CDN cache for that environment. For production, it also clears the cache for the default path.

If a publish fails

If the build, the upload or the final step fails, CookieBeam puts the previous files back and marks the new version failed. The environment stays on the version it had before, and the CDN keeps serving that version. The publish result reports failed with a reason. If putting the previous files back fails too, CookieBeam records a repair for the banner's files. The repair runs with CookieBeam's next maintenance refresh, not on a timer. Until then, the files on the CDN may be incomplete.

A failed version never becomes the current version, so you can't rebuild it. Fix the cause and publish again. The next publish creates a new version.

If the files are live but the cache clear fails, the publish still reports built, with a cache warning. CookieBeam queues the cache clear to run again. Until it runs, the CDN can serve the old files.

Promote between environments

Promotion copies the version already published in a source environment to a target environment. It does not take a new snapshot of the current draft.

The source must have a published version, and that version must still belong to the same banner. Promotion uses the same Publish permission and compliance-mode check as a direct environment publish.

Promoting to production moves the banner's current published version and rebuilds both the production environment files and the default files.

Promotion follows the same order as a publish: build, upload, then move the target environment. If it fails, the target stays on its previous version and the CDN keeps serving that version. The source environment and the stored build status of the promoted version don't change. Promote again once the cause is fixed.

Promotion reuses the source version as it is only when your plan includes all five of these features: regional targeting, multiple languages, advanced design, custom CSS and branding removal. If your plan lacks any of them, CookieBeam publishes a copy as a new version named Promotion from followed by the source environment's slug. The copy leaves out the settings of the missing features that the source uses. Custom CSS and branding removal start at the Professional plan, so on Starter every promotion creates a new version, whether or not the source uses those settings. The target points to the copy, and a failed build marks only the copy as failed.

Use the environment bundle

An environment publish writes three assets:

banner/PUBLIC_BANNER_ID/env/ENVIRONMENT_SLUG/latest.js
banner/PUBLIC_BANNER_ID/env/ENVIRONMENT_SLUG/loader.js
banner/PUBLIC_BANNER_ID/env/ENVIRONMENT_SLUG/loader-gtm.js

The production environment also writes the same assets to the default production path:

banner/PUBLIC_BANNER_ID/default/latest.js
banner/PUBLIC_BANNER_ID/default/loader.js
banner/PUBLIC_BANNER_ID/default/loader-gtm.js

loader.js is the file you install. It starts script blocking, sets up the IAB TCF stub on banners that use TCF, and then adds latest.js to the page. When latest.js has loaded, the loader adds the extra bundle for IAB TCF and GPP if the banner needs it. latest.js holds the published banner configuration and loads the banner runtime. loader-gtm.js is the same loader for the Google Tag Manager template.

Install the environment loader on a test site

Each non-production environment has its own loader, and that loader loads its own latest.js:

<script src="https://cdn.cookiebeam.com/banner/PUBLIC_BANNER_ID/env/staging/loader.js" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-noptimize="1" nowprocket="1" data-pagespeed-no-defer="1"></script>

Install the environment's loader.js. Don't load latest.js directly. The loader is what starts script blocking, installs the early TCF stub, and loads the extra bundle for IAB TCF and GPP. Without it, the test doesn't behave like production.

An environment loader doesn't run A/B tests. It always serves the version published to that environment.

The production environment's loader and the default loader are the same file. Both load default/latest.js, unless an A/B test is running. During a test they load the selected variant's latest.js and fall back to default/latest.js only if that fails.

Until an environment has a successfully built version, the dashboard shows the default URLs for it. Those are the production files. Don't copy them to a test site and expect the test version.

Never put a non-production loader on your live site.

Verify a release

  1. Confirm the publish or promotion returned built and the target environment shows the version you expect.
  2. Load the test site in a private window, or clear CookieBeam cookies and local storage first.
  3. In the browser's network panel, check that loader.js and latest.js both come from the environment path you expect.
  4. Accept, reject, and change preferences. Check that blocked scripts stay blocked until you accept.
  5. Promote the tested version to production when it's ready.

Promoting to production changes what live visitors get. A non-production publish never changes the default files.

To go back to an earlier version, see Versions and rollback. If the banner doesn't appear after a release, see Troubleshoot a missing banner.

AltStyle によって変換されたページ (->オリジナル) /