Wednesday, June 20, 2018

FIFA World Cup part 4 of 4 - XConnect

Part 4 in a series of 4
  1. Introduction
  2. Sitecore Forms
  3. Marketing Automation
  4. XConnect
Everyone's signed up, matches has started and scoring is underway. Now all we need to do is visualize who predicted what - and more importantly, a leaderboard.

To do that I need to fetch the data from XConnect. Again, I was happy to find it well documented by Sitecore. Even better, the API seems easy to use if you're familiar with LINQ. Unfortunately almost too easy for this post. I had imagined myself having to setup some indexing and doing some clever work to get my data out as I wanted it. But between the ease of use of the API, and the simplicity of my datamodel for what I need here, it's basically down to a copy/paste of a few lines from the documentation.

Friday, June 15, 2018

FIFA World Cup part 3 of 4 - Marketing Automation

Part 3 in a series of 4
  1. Introduction
  2. Sitecore Forms
  3. Marketing Automation
  4. XConnect
Having my contestants signed up, I'm ready to watch some football (yes, football!). As results starts rolling in, I need to evaluate the bets and award points.
I have chosen to use the Marketing Automation module for this. Meaning that I need to create a plan for each match.

Now, I could have gone the easy way and created all the plans before opening the signup, and just let the start action enroll contacts once they were awarded the goal in the form. However that would require that I had actually gotten that far before I opened the forms. I figured out another way, I'll get back to that later.

FIFA World Cup part 2 of 4 - Sitecore Forms

Part 2 in a series of 4
  1. Introduction
  2. Sitecore Forms
  3. Marketing Automation
  4. XConnect
Call me crazy, but for a successful office pool, having contestants is among my top priorities.
I made the signup form using Sitecore Forms. The signup itself could easily be made by the built-in components, just create "Radio button list" with [1, x, 2] options for each match.
However, being a developer, I'll be damned if I spend around 20 minutes setting up this individually for each of the 48 matches - Let's spend hours programming it instead!

Thursday, June 14, 2018

FIFA World Cup part 1 of 4 - what a wonderful excuse to learn Sitecore 9

Introduction

Ever since Sitecore 9 was announced at the symposium my fingers have been itching to try out the new features. This has been overdue for half a year now, but finally time has allowed me to take a deeper dive into Sitecore 9.
Luckily FIFA had their planning spot on for me to apply my training to a project; make an office pool for the outcome of the World Cup group matches. My weapons of choice:
  1. Basic Sitecore
    Define the groups and matches in Sitecore for use throughout the steps.
  2. Sitecore Forms
    Create form with a custom fieldtype which reflects the groups and matches.
    Identify the contact via a save action.
    Save the answers to a new contact facet.
    Award a custom goal for contact list segmentation.
  3. Sitecore Marketing Automation
    Create a custom form action for awaiting match result and scoring contacts.
    Create a default plan and automatically duplicate when each match is concluded.
  4. Sitecore XConnect
    Gather data to display leaderboards and statistics.

Whether the chosen route is the most direct is debatable, I concede that parts of this could have been much easier by purely custom code - but the goal of this exercise is to learn, fail and inspire.

I won't cover every step I have taken, but will share my thoughts and try to link the relevant documentation and blog posts that helped me along my way.

Part 1 - Basic Sitecore

While the basic Sitecore setup brings nothing new to the table, I will do a quick rundown for reference on the later steps.

The idea is to create each individual match only once manually. The forms and Marketing Automation will use these as datasource. These matches will also have a layout, to be able to show statistics and scoring for the individual matches.

Without further ado, this is the setup:

Screenshot of the matches folder and data

Enrolling a contact list to a Marketing Automation plan

The new Marketing Automation in Sitecore 9 has a lot of built in options to automatically enroll contacts as they trigger goals or events, or satisfy custom conditions. However this is largely focused around user actions and not marketings desire to enroll a group of contacts into a plan.

I was posed with a problem where I needed to enroll contacts that had already ended their interaction. For this I made a simple service that would enroll all contacts from a given Sitecore List Manager list into my Marketing Automation plan.

Making this was surprisingly easy by combining the enrolling a contact in a single plan and the list manager api guides from Sitecores' documentation.

Working with the Marketing Automation api programatically

The new Marketing Automation interface is awesome and it has a lot of great functionalities. However it seems that much of the implementation has been made with the interface/frontend in mind.

I wanted to be able to duplicate a plan programmatically, much like the "Copy" button in the interface.

The copy plan button in the Marketing Automation interface