Extension manifest
In your extension’s base directory you must create a file called extension.json
. This contains critical details about your extension that allows Adobe Experience Platform to properly consume it. Some of the contents are formed after the manner of npm’s package.json
.
An example extension.json
can be found the Hello World extension GitHub repository.
An extension manifest must consist of the following:
name
platform
web
.version
displayName
description
iconPath
(Optional).svg
extension. The SVG should be square and may be scaled by Platform.author
The “author” is an object which should be structured as follows:
name
: The name of the extension author. Alternatively, the company name can be used here.url
(Optional): A URL where you can find out more about the extension author.email
(Optional): The email address of the extension author.
This is consistent with npm author field rules.
exchangeUrl
(Required for public extensions)https://www.adobeexchange.com/experiencecloud.details.######.html
.viewBasePath
src/view/
, the value of viewBasePath
would be src/view/
.hostedLibFiles
(Optional)This option contains an array with relative paths of 3rd party library files that need to be hosted.
main
(Optional)This module will always be included in the runtime library and executed. Because the module is always included in the runtime library, we recommend only using a “main” module when absolutely necessary and keeping its code size minimal.
This module is not guaranteed to be executed first; other modules may be executed before it.
configuration
(Optional)events
(Optional)conditions
(Optional)actions
(Optional)dataElements
(Optional)sharedModules
(Optional)An array of shared module definition objects. Each shared module object in the array should be structured as follows:
name
: The name of the shared module. Note that this name will be used when referencing shared modules from other extensions as described in Shared Modules. This name is never displayed in any user interface. It should be unique from the names of other shared modules within your extension and must comply with naming rules. This is used by tags as an identifier and should not be changed after you publish your extension.libPath
: The relative path to the shared module. It should not not begin with a slash. It must reference a JavaScript file with a.js
extension.
Appendix
Naming rules naming-rules
The value of any name
field within extension.json
must comply with the following rules:
- Must be less than or equal to 214 characters
- Must not start with a dot or an underscore
- Must not contain uppercase letters
- Must only contain URL-safe characters
These are consistent with npm package name rules.
Configuration object properties config-object
The configuration object should be structured as follows:
viewPath
viewBasePath
and should not begin with a slash. It must reference an HTML file with a .html
extension. Query string and fragment identifier (hashes) suffixes are acceptable.schema
An object of JSON Schema describing the format of a valid object being saved from the extension configuration view. Since you are the developer of the configuration view, it is your responsibility to ensure that any settings object saved matches this schema. This schema will also be used for validation when users attempt to save data using Platform services.
An example schema object is as follows:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"delay": {
"type": "number",
"minimum": 1
}
},
"required": [
"delay"
],
"additionalProperties": false
}
We recommend using a tool like JSON Schema validator to manually test your schema.
transforms
(Optional)Type definitions type-definitions
A type definition is an object used to describe an event, condition, action, or data element type. The object consists of the following:
name
displayName
categoryName
(Optional)displayName
will be listed under the categoryName
within the UI. All types with the same categoryName
will be listed under the same category. For example, if your extension provided a keyUp
event type and a keyDown
event type and they both had a categoryName
of Keyboard
, both event types would be listed under the Keyboard category while the user is selecting from the list of available event types when building a rule. The value of categoryName
should be human-readable.libPath
.js
extension.viewPath
(Optional)viewBasePath
and should not begin with a slash. It must reference an HTML file with a .html
extension. Query strings and fragment identifiers (hashes) are acceptable. If your type's library module does not use any settings from a user, you may exclude this property and Platform will instead display a placeholder stating that no configuration is necessary.schema
An object of JSON Schema describing the format of a valid settings object that can be saved by the user. Settings are usually configured and saved by a user using the Data Collection user interface. In these cases, the extension's view can take necessary steps to validate user-provided settings. On the other hand, some users choose to use tags APIs directly without the aid of any user interface. The purpose of this schema is to allow Platform to properly validate that settings objects saved by users, regardless of whether a user interface is used, are in a format that is compatible with the library module that will act upon the settings object at runtime.
An example schema object is as follows:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"delay": {
"type": "number",
"minimum": 1
}
},
"required": [
"delay"
],
"additionalProperties": false
}
We recommend using a tool like JSON Schema validator to manually test your schema.
transforms
(Optional)Transforms transforms
For certain specific use cases, extensions need the settings objects saved from a view to be transformed by Platform before they are emitted into the tag runtime library. You may request that one or more of these transforms take place by setting the transforms
property when defining a type definition within your extension.json
. The transforms
property is an array of objects where each object represents a transformation that should take place.
All transforms require a type
and a propertyPath
. The type
must be one of function
, remove
, and file
and describes which transform Platform should apply to the settings object. The propertyPath
is a period-delimited string that tells tags where to find the property that needs to be modified within the settings object. Here is an example settings object and some propertyPath
s:
{
foo: {
bar: "A string",
baz: [
"A",
"B",
"C"
]
}
}
- If you set a
propertyPath
offoo.bar
you would transform the"A string"
value. - If you set a
propertyPath
offoo.baz[]
you would transform each value in thebaz
array. - If you set a
propertyPath
offoo.baz
you would transform thebaz
array.
Property paths can use any combination of array and object notation to apply transforms at any level of the settings object.
propertyPath
attribute (e.g. foo.baz[]
) is not yet supported in the extension sandbox*tool.The sections below describe the available transformations and how to use them.
Function transform
The function transform allows code written by Platform users to be executed by a library module within the emitted tag runtime library.
Let’s assume we would like to provide a “custom script” action type. The “custom script” action view might provide a textarea wherein the user can enter some code. Let’s assume a user entered the following code into the textarea:
console.log('Welcome, ' + username +'. This is ZomboCom.');
When the user saves the rule, the settings object saved by the view may look like this:
{
foo: {
bar: "console.log('Welcome, ' + username +'. This is ZomboCom.');"
}
}
When a rule using our action fires within the tag runtime library, we would like to execute the user’s code and pass it a username.
At the point that the settings object is saved from the action type’s view, the user’s code is simply a string. This is good because it can be properly serialized to and from JSON; however, it’s also bad because it would typically be emitted in the tag runtime library as a string as well instead of an executable function. Although you could attempt to execute the code within your action type’s library module using eval
or a Function constructor, it is highly discouraged due to content security policies potentially blocking execution.
As a workaround for this situation, using the function transform tells Platform to wrap the user’s code in a executable function when it is emitted in the tag runtime library. To solve our example problem, we would define the transform on the type definition in extension.json
as follows:
{
"transforms": [
{
"type": "function",
"propertyPath": "foo.bar",
"parameters": ["username"]
}
]
}
type
defines the type of transform that should be applied to the settings object.propertyPath
is a period-delimited string that tells Platform where to find the property that needs to be modified within the settings object.parameters
is an array of parameter names that should be included in the wrapping function’s signature.
When the settings object is emitted in the tag runtime library, it will be transformed to the following:
{
foo: {
bar: function(username) {
console.log('Welcome, ' + username +'. This is ZomboCom.');
}
}
}
Your library module can then call the function containing the user’s code and pass in the username
argument.
File transform
The file transform allows code written by Platform users to be emitted into a file separate from the tag runtime library. The file will be hosted alongside the tag runtime library and can then be loaded as needed by your extension at runtime.
Let’s assume we would like to provide a “custom script” action type. The action type’s view might provide a textarea wherein the user can enter some code. Let’s assume a user entered the following code into the textarea:
console.log('This is ZomboCom.');
When the user saves the rule, the settings object saved by the view may look like this:
{
foo: {
bar: "console.log('This is ZomboCom.');"
}
}
We would like the user’s code to be placed into a separate file instead of included inside in the tag runtime library. When a rule using our action fires within the tag runtime library, we would like to load the user’s code by appending a script element to the document body. To solve our example problem, we would define the transform on the action type definition in extension.json
as follows:
{
"transforms": [
{
"type": "file",
"propertyPath": "foo.bar"
}
]
}
type
defines the type of transform that should be applied to the settings object.propertyPath
is a period-delimited string that tells Platform where to find the property that needs to be modified within the settings object.
When the settings object is emitted in the tag runtime library, it will be transformed to the following:
{
foo: {
bar: "//launch.cdn.com/path/abc.js"
}
}
In this case, the value of foo.bar
has been transformed to a URL. The exact URL will be determined at the time the library is built. The file will always be given a .js
extension and delivered using a JavaScript-oriented MIME type. We may add support for other MIME types in the future.
Remove transform
By default, all the properties of the settings object are emitted in the tag runtime library. If certain properties are only used for the extension view, especially if they contain sensitive information (eg. secret token), you should use the remove transform to prevent the information from being emitted into the tag runtime library.
Let’s assume we would like to provide a new action type. The action type’s view might provide an input wherein the user can enter a secret key that will allow connection to a specific API. Let’s assume a user entered the following text into the input:
ABCDEFG
When the user saves the rule, the settings object saved by the view may look like this:
{
foo: {
bar: "ABCDEFG"
}
}
We would like to not include the property bar
inside in the tag runtime library. To solve our example problem, we would define the transform on the action type definition in extension.json
as follows:
{
"transforms": [
{
"type": "remove",
"propertyPath": "foo.bar"
}
]
}
type
defines the type of transform that should be applied to the settings object.propertyPath
is a period-delimited string that tells Platform where to find the property that needs to be modified within the settings object.
When the settings object is emitted in the tag runtime library, it will be transformed to the following:
{
foo: {
}
}
In this case, the value of foo.bar
has been removed from the settings object.