Blog / Development

3 New Kentico Cloud Features Developers Are Going to Love


by Bryan Soltis

Nov 7, 2017

With Kentico Cloud being a SaaS (Software as a Service), our development team is constantly improving the product. By controlling the environment, we can push out improvements on a regular basis. Recently, we rolled out several features that are going to make your development with the platform even better. I’ll fill you in on the latest enhancements.

The Development Express is a fast train to catch. Every day, new libraries, platforms, and languages are being rolled out. Because the landscape is always changing, headless CMSs like Kentico Cloud have to constantly evolve to keep pace. This means the development model is extremely agile, with updates on a regular basis.

To provide as much functionality as possible, we release enhancements to Kentico Cloud every month. These improvements bring new capabilities to the platform, and allow developers to build amazing solutions. Recently, we released a number of new features that will bring you some exciting capabilities, as well as simplify your project development.

Here are 3 awesome things developers are going to love in Kentico Cloud:

Content Type Snippets

When defining content types in Kentico Cloud, developers will often have a similar collection of elements for multiple content types. This means you may have the same fields in multiple types, duplicating your structure in many areas. Content Type Snippets are the answer.

With Content Type Snippets, you can define a “standard” collection of elements to be quickly added to any content type. This can save a lot of administration and development, as the snippets can be used for many types within a project. Let’s take a look at an example.

In my project, I have 2 content types (Movies and Books). Each type has some context-specific fields (Genre, Director, Author, etc.). While these elements are unique, both will have a Title and a Release Year. These are good candidates for a Content Snippet to simplify the content authoring process. Here is a video of adding the content snippet and entering content.

Kentico Cloud Content Snippets


You can learn more about Content Type Snippets here.

Custom Activity Tracking

Another big part of building applications is data collection. Owners want to know everything that happens within a site, so ensuring you can accurately track a user’s behavior is critical. With Kentico Cloud’s new Custom Activity Tracking feature, you can easily log any activity within your code. With that information, you can generate contact segments, build user profiles, and leverage the Personalization API to customize the user’s experience.

In Kentico Cloud, go to Development / Tracking / Activity Tracking to define your activities.


With your activities defined, you can update your code to track the user activity. Let me show you how. First, I added the Tracking Code to my site.

<head>
    ...
    <script type="text/javascript">
    !function(){
        var a='https://engage-ket.kenticocloud.com/js',
            b=document,
            c=b.createElement('script'),
            d=b.getElementsByTagName('script')[0];
        c.type='text/javascript',
        c.async=!0,
        c.defer=!0,
        c.src=a+'?d='+document.domain,
        d.parentNode.insertBefore(c,d)
    }
    (),
    window.ket=window.ket||function(){
        (ket.q=ket.q||[]).push(arguments)
    };
    ket('start', '315d00ad-3ba9-4d8d-a965-86ac52d1f347');
    </script>
</head>


Next, I added a link to the Home page to track the activity.

<h2>
    <a href="/about"
       onclick="ket('action', 'CLICK-AboutPageLink')">
        Check out the ABOUT page
    </a>
</h2>


After accessing the site a few times and clicking the link, the site created several anonymous contacts and tracked their activity. I then created a new Segment, containing only visitors who clicked the link.


By tracking the custom activity, I can easily group users by their behavior and then customize the site based on their preferences and activity. This means a much more personalized experience for site users and more engaging content. 

You can learn more about Custom Activity Tracking here.

Content Management API

Ever since Kentico Cloud was released, developers have asked how to write data into the system. Well, the great news is that you now can! With the new Content Management API, you can easily insert your existing content into Kentico Cloud. This new functionality allows you to migrate existing content repositories (from another CMS or database) to Kentico Cloud. 

In the Kentico Cloud application, go to Development / API Keys and enable the Content Management API. This creates a new API key that is valid for one month. The reason for the expiration is that the API is currently not designed for continuous content migration, but rather a onetime processing of data into the system.


After enabling the functionality, you are ready to migrate your content. In my demo, I had some existing Simpson quotes (why not?) I wanted to bring into Kentico Cloud. I create a new content type in Kentico Cloud and Console App to do the processing. 

Here is the content type.


And here is the migration code in my console app.

                client.BaseAddress = new Uri("https://manage.kenticocloud.com/projects/" + strProjectID  + "/ ");
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", strAPIKey);
                
                ...

                foreach (Element element in lstQuotes)
                {
                    // Create a new Quote object for each record
                    Quote quote = new Quote();
                    quote.sitemap_locations = new List<string>();
                    quote.type = new Type { codename = "quote" };
                    quote.name = element.quoteauthor + " - " + DateTime.Now.Millisecond.ToString();
                    quote.elements =element;

                    // Create the item within the Kentico Cloud project
                    HttpResponseMessage response = await client.PostAsJsonAsync("items", quote);
                    response.EnsureSuccessStatusCode();

                    // Parse the response
                    JObject jobj = JObject.Parse(response.Content.ReadAsStringAsync().Result);

                    // Update the new item with the quote details
                    HttpResponseMessage response2 = await client.PutAsJsonAsync("items/" + (string)jobj["id"].Value<string>() + "/variants/codename/default", quote);
                    response2.EnsureSuccessStatusCode();
                }

 

After running the console app, I confirmed the content was successfully copied into my Kentico Cloud project. Note that I added a DateTime.Now.Millisecond value to end of each quote for uniqueness.


NOTE
The Content Management API is still in BETA, so I will follow up this blog post with a more detailed look once it’s released.

You can learn more about the new Content Management API here.

Moving Forward

The last month brought some pretty awesome features to Kentico Cloud. This new functionality is designed to help you build better applications and offer more capabilities to your users. 

With Content Type Snippets, data can be structured and managed much easier. With Custom Activity Tracking, developers will be able to know exactly when and where a user performed an action, enabling them to build personas and customize the user’s experience. 

Probably the most powerful addition, the Content Management API will allow you to migrate your existing content into Kentico Cloud with ease. We hope you enjoy the features and keep an eye out for more to come. Good luck!