Decision based on Query Parameters
What you'll build
You will learn how to use a Surface component workflow to read the query parameters and make decisions based on it. If your page is served via a MonetizationOS Proxy, query parameters from the client request are included automatically in the Surface Decisions API request.
1. Prerequisites
- You will need a Component Workflow in a Surface
2. Add a component
const : = async ({ }) => {
if (!.) {
return {};
}
const = new (.);
const = ..("test") === "123";
return {
: {
: true,
: [
{
: "html",
:
? "<h1>The Query matches</h1>"
: "<h1>The Query does not match</h1>",
},
],
},
};
};
export default ;Result
A response is returned based on whether the query parameter matches.