Azion Content Targeting is a serverless integration from Azion Marketplace.
This integration allows you to manipulate cookies and headers for flexible usage logics. This function can handle specific application contexts, business rules, or other customer-defined scenarios, as well as content segmentation.
You can create different scenarios and define variants and distribution percentages for each scenario using the Content Targeting integration. This allows a greater assertiveness without taxing resources and interactions at the source. Furthermore, you can create processing logic at the edge, broadening the function’s application possibilities and reaping benefits such as targeted cache, absorption of access peaks, high performance, distributed processing logic, and event registration via data streaming.
Getting the integrationSection titled Getting the integration
To use the Content Targeting integration provided at Azion Marketplace, follow these steps:
- Access Real-Time Manager (RTM) and go to Marketplace.
- On the Marketplace homepage, look for the Content Targeting card and select it.
- On the integration’s page, click the Get It Now button to install it.
A successful message appears to confirm your integration is installed.
Configuring the integrationSection titled Configuring the integration
Once you’ve gotten your integration on Marketplace, you’ll have to select an edge application to use the integration.
To configure your integration, proceed as follows:
- On the upper-left corner, select Products menu > Edge Application on the BUILD section.
- On the listing page of your edge applications, select the one you want to use with the Content Targeting integration.
- On the application page, in the Main Settings tab, locate and click the Edge Functions switch to enable edge functions on your edge application.
- Click the Save button.
You’ll receive a successful message indicating your edge application was updated.
Instantiating the integrationSection titled Instantiating the integration
To enable this function, while still on the Edge Application page:
- Select the Functions tab.
- Click the Add Function button.
- Choose an easy to remember name for your function.
- On the dropdown function menu, select the Content Targeting [Global] function.
This action will load the function, showing a form with the function’s code and, just above it, two tabs: Code and Args. Click on the Code tab and you’ll be able to navigate through the code, but won’t be able to change it. On the Args tab, you’ll pass the integration parameters.
You’ll pass the parameters via the Args tab in a
JSON file that will look like this:
|Represents the cookie which will be used to store the chosen value
|Represents the header which will be used to store the chosen value
|Defines the domain for which the cookie will be set
|Defines how long (in seconds) the cookie value will be valid
expires aren’t require, it’s highly recommend using at least one of them, otherwise the cookie won’t be stored.
Another important fact is that these field don’t replace one another, in fact, the
expires one is just a fallback for older browsers which still doesn’t work with the
|Legacy way to define how long a cookie will be stored.
When using this format you must input a complete date.
|Defines the path to where the cookie will be valid
|Yes (the list must have at least one entry)
|Describes each possible value to be chosen
value (required) represents the value which will be set in the cookie/header if this option is chosen.
weight (required) defines the odds of the option being chosen.
cache_key (optional) defines a custom cache key for the request whenever this option is chosen.
Configuring a rule on Rules EngineSection titled Configuring a rule on Rules Engine
Now you have to configure the rules you want (criteria and behavior) to apply to run your function.
Still in the Edge Applications page, follow these steps:
- Select the Rules Engine tab.
- Click on Default Rule.
- You can’t change the criteria field for the Default Rule on Rules Engine.
- On the behavior field, select Run Function from the dropdown menu.
- Select the Content Targeting function, according to the name you gave it in the instantiation step.
- Click the Save button.
Done. Now you have your Content Targeting function running on the edge.
For more information about how to use the Content Targeting integration, visit the Use Case at Using cookies and logic from Edge Computing for content-targeting.