All Collections
Advanced options
Adding categories to your content
Adding categories to your content

This article explains how a category feed or csv needs to be formatted and how categories are assigned to content items.

Christiaan Proper avatar
Written by Christiaan Proper
Updated over a week ago

You know it's possible to add content to your Datatrics project. You may however be asking yourself if there are ways to structure this content. This is where categories can be a solution. Adding categories allows you to not only filter content very easily. It also makes it possible to filter on pagetype: category in touchpoints. Besides these points they give you the option to only display items of a certain category on the corresponding category page and have content cross-reference each other to make Cross/Up-Selling easier.

So, how do you add categories to your content?

1. Creating categories for category pages

We recommend adding categories (for pages) through the custom importer. This can either be done using a comma separated CSV or XML format. Need more information about the custom importer? Check out this article.

CSV

The above screenshot is an example of an import for category pages using the CSV format. As you can see, we have added a "Categoryid" value to the file, the name of the categorypage and the url. 

you can map these in the custom importer by choosing for categories, and using item. for the mapping of the fields.

XML

If you want to add a dynamic feed instead, it is recommended to use the XML format.
The format required to import categories using XML can be seen below.

<categories> 
    <category>
        <categoryid>100<categoryid</>
        <name>platform<name/>
        <url>https://www.datatrics.com/nl/platform/</url>
    </category>
</categories>

2. Assigning categories to content

After categories have been set-up, we need to assign categories to content. We can do this using by adding below format to the content feed in the following format for every item, you can decide the amount of categories assigned to the item:

<categories>
    <category>
        <categoryid>{id}</categoryid>
        <url>{category_url}</url>
    </category>
    <category>
        <categoryid>{id_2}</categoryid>
        <url>{category_url_2}</url>
    </category>
</categories>

By filling in a matching category_id and category_url, items with matching values, will be assigned to the category. Below is an example of an import, matching on the above category pages: 

 {
    "name": "platform",
    "url": "https://www.datatrics.com/nl/platform/",
    "categoryid": "100"
  },
  {
    "name": "demo",
    "url": "https://www.datatrics.com/nl/demo/",
    "categoryid": "205"
  },

As you can see, this content item has been assigned to 2 categories. This has been achieved by assigning the following values:
CategoryID - mandatory
URL - recommended
Name - recommended

You can check if the import for category pages went correct with the API-calls described below (it can take up to an hour for categories to be available with these calls, you can just open them in your browser):

Call for all categories:
https://api.datatrics.com/2.0/project/{{projectid}}/content?type=category&apikey={{apikey}}

Call for a single category page:
https://api.datatrics.com/1.1/Boxes/getCategory?apikey={{apikey}}&projectid={{projectid}}&url={{example_URL_category_page}}

Did this answer your question?