Manifest
The manifest describes the parameters the Uniform tracker uses during the classification process. The settings included in the manifest are defined in a Uniform project under the sections Personalization and Testing.
Classification criteria is configured within Uniform, but that information is used outside of Uniform. For example, in order for the client-side tracker to classify visitors, the tracker must know what the classification rules are. The Uniform manifest is the way that information is provided to components that exist outside of Uniform.
The manifest is generated using the Uniform CLI.
Download the manifest#
The Uniform manifest is a JSON file that describes the classification rules that are configured in Uniform. In order for the Uniform tracker to classify a visitor, it needs to know this configuration. As a result, the Uniform tracker needs the manifest.
Why download the manifest?#
Uniform's classification and personalization features depend on the Context manifest. The manifest is used for client-side tracking and edge-side personalization.
You may want to retrieve the manifest when you build your front-end application or the application that runs edge-side personalization so it can be packaged along with the application.
Download with terminal#
These steps will you to download the manifest to a file manifest.json
from a terminal.
If it's not already installed, install the CLI.
If it's not already installed, install the package
@uniformdev/context
globally.Create an API key with the following permissions:
- Uniform Context > Manifest > Read
- Run the following command:
`uniform context manifest download \\ -o ./manifest.json \\ -p <UNIFORM_PROJECT_ID> \\ -k <UNIFORM API KEY>`}
What has changed
When the command finishes, a file
manifest.json
is created.
Download with npm script#
These steps will allow you to download the manifest to a file manifest.json
using an npm script.
If it's not already installed, install the CLI.
If it's not already installed, install the package
@uniformdev/context
in the project. Create an API key with the following permissions:- Uniform Context > Manifest > Read
Add the following file:
{`UNIFORM_PROJECT_ID=<UNIFORM PROJECT ID>\nUNIFORM_API_KEY=<UNIFORM API KEY>`}
Make the following change:
... "scripts": { "download:manifest": "uniform context manifest download -o ./manifest.json", ... } ... }`}
You can run the command from a terminal, or as a part of another npm script using the following command:
npm run download:manifest
What has changed
When the command finishes, a file
manifest.json
is created.
Automate manifest download#
This section describes how to add a script that downloads the manifest to a Node project. Your CI/CD process can trigger the script in order to automate downloading the manifest.
Prerequisites
These instructions assume you already have a Node project and a Uniform project.
Make sure the following dependencies are included in your Node project. If you need to add them, you can add them as developer dependencies:
@uniformdev/cli @uniformdev/context
Make sure you have a
.env
file with the values needed to connect to your Uniform project.UNIFORM_API_KEY=<YOUR API KEY> UNIFORM_PROJECT_ID=<YOUR PROJECT ID>
Add the following script to your
package.json
file:package.json
{ "name": "my-package", "version": "0.1.0", "private": true, "scripts": { "download:manifest": "uniform context manifest download -o ./manifest.json", }, "dependencies": { "@uniformdev/context": "17.7.0" }, "devDependencies": { "@uniformdev/cli": "17.7.0", "npm-run-all": "^4.1.5" } }
To download the manifest, run the following command.
Download manifest
npm run download:manifest
About this step
A file named
manifest.json
is created in the root folder of your Node project.
Get intent manifest#
The intent manifest is usually retrieved as a part of the build process for the front-end application using an npm script to call the Uniform CLI. However, it can be retrieved in other ways as well.
const axios = require("axios");
axios.get('https://uniform.app/api/v2/manifest', {
params: {
preview: false,
projectId: "[!!! UNIFORM PROJECT ID !!!]",
},
headers: {
accept: "application/json",
"x-api-key": "[!!! UNIFORM API KEY !!!]",
}
}).then(response => {
const manifest = response.data;
// Do something with the manifest.
});