1 of 20
2 of 20
3 of 20
4 of 20
5 of 20
6 of 20
7 of 20
8 of 20
9 of 20
10 of 20
11 of 20
12 of 20
13 of 20
14 of 20
15 of 20
16 of 20
17 of 20
18 of 20
19 of 20
20 of 20

doc

How to install the Content Targeting solution through Azion Marketplace

Overview

The Azion Content Targeting solution is a serverless solution from Azion Marketplace.

This solution 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 solution. 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.


  1. Getting the solution
  2. Using the solution
  3. Configuring the solution
  4. Instantiating the solution
  5. Configuring a rule on Rules Engine

1. Getting the solution

To use the Content Targeting solution provided at Azion’s Marketplace, follow these steps:

  1. Access Real-Time Manager (RTM) and log in.
  2. On the upper-left corner of the page, select Products menu, represented by three horizontal lines > Marketplace.
  3. On the Marketplace’s homepage, type “Content” in the search box or browse through the cards below it to find the desired Content Targeting solution.
  4. Once you get the Content Targeting solution’s card, select it to go to the solution page.
  5. On the solution page, look for the Subscribe for section on the bottom-right corner.
  6. Click the Get It Now button.

A successful message appears. Your solution is installed and ready to use.


2. Using the solution

Once you’ve gotten your solution on Marketplace, it’ll be available at your Edge Functions list. You’ll have to select an edge application to use the solution.

For this task you have several modes of action. The main ones are:

  • Visit the getting started documentation to create a new edge application.
  • Create an edge application in RTM by selecting Products menu > Edge Application and follow the instructions.
  • Use an existing edge application.

3. Configuring the solution

To configure your solution, proceed as follows:

  1. On the upper-left corner, select Products menu > Edge Application on the BUILD section.
  2. On the listing page of your edge applications, select the one you want to use with the Content Targeting solution.
  3. On the application page, in the Main Settings tab, locate and click the Edge Functions switch to enable edge functions on your edge application.
  4. Click the Save button.

You’ll receive a successful message indicating your edge application was updated.


4. Instantiating the solution

To enable this function, while still on the Edge Application page:

  1. Select the Functions tab on the top list.
  2. Click the Add Function button.
  3. Choose an easy to remember name for your function.
  4. 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 solution parameters.

You’ll pass the parameters via the Args tab in a JSON file that will look like this:

{
  "cookie_name": "azion-cookie",
  "header_name": "azion_header",
  "domain": ".azion.com",
  "max_age": 600,
  "expires": "Tue, 19 Jan 2038 03:14:07 GMT",
  "path": "/",
  "values": [
    {
      "value": "A",
      "weight": 7.1,
      "cache_key": "custom_a"
    },
    {
      "value": "B",
      "weight": 14.9
    }
  ]
}

Where:

Key Data Format Required Description Notes
cookie_name String Yes Represents the cookie which will be used to store the chosen value. -
header_name String Yes Represents the header which will be used to store the chosen value. -
domain String Yes Defines the domain for which the cookie will be set. -
max_age Integer No Defines how long (in seconds) the cookie value will be valid. While max_age and 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 max_age directive.
expires String No Legacy way to define how long a cookie will be stored.

When using this format you must input a complete date.
-
path String Yes Defines the path to where the cookie will be valid. -
values Object 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.

5. Configuring a rule on Rules Engine {#rules-engine)

Still in the Edge Applications page, in the Rules Engine tab, you have to configure the rules you want (criteria and behavior) to apply to run your function.

To do so, follow these steps:

  1. Select the Rules Engine tab.
  2. Click on Default Rule.
    • You can’t change the criteria field for the Default Rule on Rules Engine.
  3. On the behavior field, select Run Function from the dropdown menu and then select the Content Targeting function, according to the name you gave it in the instantiation step.
  4. 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 solution, visit the Use Case at Using cookies and logic from Edge Computing for content-targeting.


Didn’t find what you were looking for? Open a support ticket.