MonetizationOS Docs
Getting StartedIntegrate with MOS

WordPress VIP Edge Worker Proxy

The MonetizationOS WordPress VIP Edge Worker Proxy is an open source integration that adds server-side monetization decisions to sites hosted on WordPress VIP.

View on GitHub

What are WordPress VIP Edge Workers?

WordPress VIP Edge Workers run code on VIP's edge servers, in front of your site's cache. Workers are written in AssemblyScript and compiled to WebAssembly, and you deploy them with VIP-CLI.

Why use the edge worker?

The proxy decides after VIP's cache, so your origin renders each page once per cache lifetime while every reader still gets a personal decision. It needs no changes to your WordPress code.

cache misspage HTMLReaderVIP edge workerMonetizationOS proxyVIP cacheWordPress originMonetizationOS API
cache misspage HTMLReaderVIP edge workerMonetizationOS proxyVIP cacheWordPress originMonetizationOS API

The worker sends each HTML page to the Surface Decision API, and MonetizationOS applies the surface's Component Behaviors and returns the transformed page.

Installation and configuration

Prerequisites

  • A WordPress VIP environment that supports Edge Workers, and an authenticated VIP-CLI
  • Node.js 22+
  • Your MonetizationOS secret key, from environment settings. It must be a secret (sk_) key, because only a secret key can send the page
  • Whole-body mode enabled for your organization. Contact MonetizationOS to turn it on. Until it is, the API refuses the page and readers get it unmodified

1. Clone and build

git clone https://github.com/MonetizationOS/vip-edge-workers-proxy.git
cd vip-edge-workers-proxy
npm install
npm run build

This produces build/mos-proxy/release.wasm, the worker to deploy.

2. Set environment variables

Set these in the worker's environment:

VariableDescription
MOS_SECRET_KEYYour MonetizationOS secret key.
MOS_HOSTMonetizationOS API host, for example https://api.monetizationos.com.
MOS_SURFACE_SLUGThe MonetizationOS surface to evaluate for every HTML page.

If any of the three is missing, the worker passes every request through untouched.

For cookie names, ignored paths, gradual roll-out and the other settings, see the WordPress VIP Edge Worker Proxy reference.

3. Deploy

Publish build/mos-proxy/release.wasm with VIP-CLI, following WordPress VIP's Edge Workers documentation. Test on a non-production environment first.

4. Roll out gradually (optional)

Set MOS_DECISIONS_PERCENT to a number from 0 to 100 to send only that share of readers to MonetizationOS. The rest get the cached page. Raise it as you gain confidence.

Run locally

The repository carries a local host for the worker, so you can try it without deploying:

npm run web

This serves a browser playground at http://localhost:8787. To run it against your own organization, copy .env.local.example to .env.local.

Run tests

npm run test:all

For canonical setup details and updates, see the project README.

Next steps

On this page