Plugins

Last updated 7 months ago

Plugins allow you to extend the default features of DrEdition to better suit your particular needs.

A/B Testing

Located at DrEdition: "Settings" -> "Plugins" -> "Variant Statistics"

This feature is not enabled by default since it requires custom implementation by the customer. Contact us on suppport@aptoma.com to get started. When it's enabled it can be started when editing an edition item. The workflow is shown in this video.

When a test is started the item will include all the variants in the API under the property variants on each edition item. The data for each variant will only include fields that the user has chosen to override for that variant.

Here's an example of API output for an item with variants:

{
"data": {
"type": "story",
"title": "A story title",
"id": "5-42-162786"
},
"variants": [
{
"name": "A",
"id": "59eb6e617f6c851811fe636f"
},
{
"name": "B",
"data": {
"title": "A different story title"
},
"id": "59eb6e617f6c851811fe636e"
}
]
}

Automate test winner

Use this endpoint in our API to select a winner for the test and end it. Please note that if someone is working on that edition while ending the test, the user will receive a notification that the edition has been updated and that he/she should reload the edition. This is expected to be disruptive for the user, so we currently recommend not using this endpoint on manually curated editions.

Statistics

This is enabled by using our custom plugin system which allow you to fetch the statistics from your own external A/B testing system and display it live in DrEdition. This is still under development so contact us and we'll help you getting started.

Item Indicators

Located at DrEdition: "Settings" -> "Plugins" -> "Item Indicators"

With item indicators, you can add small colored discs to edition items, to give a quick visual indication about some property of the item. An example use case is to highlight premium content. The discs will be shown both in the import list and the edition list:

You can define a title and color for the disc, as well as a path for deciding whether the indicator should be shown. The path should evaluate to a truthy value.

Let's assume this item data:

{
"data": {
"title": "Some title",
"isPremium": true,
"publishTime": 1496922655841,
"meta": {
"score": 12
}
}
}

An item's data properties will be available when evaluating paths. In addition, $now can be used to compare with the current unixtime (including milliseconds). Here's a few paths that you might set:

  • isPremium to simply evaluate the value of data.isPremium

  • meta.score < 10 to compare values

  • publishTime > $now will compare publishTime to the current unixtime

  • isPremium && meta.score > 10 to combine multiple expressions

Note: The value of $now is initialised when an item is rendered in DrEdition, it will not update the value continuously.

Area of Interest Image Cropping

Located at DrEdition: "Settings" -> "Plugins" -> "Area of interest"

With area of interest based image cropping enabled, DrEdition will analyze your images and identify faces and features, and give you data about the area of interest. This will also change the image cropper to only mark the area of interest, instead of doing an exact crop. This gives more flexibility for when you need to use an image in different contexts, and perhaps optimize for wider or narrower crops depending on which context the image is being used in (i.e portrait on mobile screens and landscape on desktop screens).

To enable area of interest, you need to add a plugin named area-of-interest with an empty schema (we'll create a template for this later):

{
"type": "object",
"properties": {}
}

Then add a property with format "areaOfInterest" to the image field in your content schema(s):

"image": {
"properties": {
"url": {
"format": "imageUrl",
"title": "URL",
"type": "string"
},
"width": {
"title": "Width",
"type": "number",
"format": "imageWidth"
},
"height": {
"title": "Height",
"type": "number",
"format": "imageHeight"
},
"id": {
"title": "Image ID",
"type": "string",
"format": "imageId"
},
"aoi": {
"title": "Area of Interest",
"format": "areaOfInterest",
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"width": {
"type": "number"
},
"height": {
"type": "number"
},
"focus": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
}
},
"origin": {
"type": "string"
}
}
}
},
"title": "Image",
"type": "object",
"format": "image"
}

The properties of the area of interest field cannot be customized, but you can name the field itself whatever you want.

aoi.focus will be set to the center of the detected faces in the image. origin will be auto if the values have been set by our analysis, and manual if the area of interest has been been set manually by a user. When set manually by the user, focus will not be available, as it's assumed that user will correctly mark the relevant area.

Whenever DrEdition encounters an item with area of interest in the schema, we'll populate the values. However, you can enable the cropper on a per-product basis, so that you may still use the regular cropper. Be aware that when images have been cropped, the width and height of the image object does not match the area of interest properties, as these are always based on the original image.

We have also created a smart crop NPM module you can use to interact with the area of interest data: https://www.npmjs.com/package/@aptoma/aoi-smart-crop‚Äč