An updated version of this helpdoc can be found here: https://helpdocs.conducttr.com/feature-documentation/designing/scenario-design/dynamic-content 

Goal

After reading this article you'll:
  • understand what Smartwords are
  • be able to create content that can change dynamically 

Summary

Smartwords is the term we use to describe variables embedded in your exercise content. These variables can be changed dynamically which means content can be quickly customised.

 Name
Smartwords
 Benefits
Saves time and improves engagement through greater personalisation: allows you to create content that can be easily changed through use of variables
 Features
  • Create dynamic words, paragraphs and whole content that can change using data uploaded to a custom_data table
  • Basic use using {} delimiters
  • Advanced use using full range of Conducttr functions using the || delimiters


Understanding Smartwords

Imagine how much time you would save by being able to quickly and easily personalise an exercise for each client or each office. Smartwords allow you to do this.

Instead of writing...

"Please be at the West Ham football ground in two hours from now and meet me at the Bobby Moore entrance"
you would write...

"Please be at the {data.stadium} football ground in two hours from now and meet me at the {data.entrance} entrance"
The actual stadium name and entrance are saved in a table called the custom_data table. The data can be saved to a file and you'd create a data file for each office or client. The matching data table for each office/client is then uploaded before the exercise starts to personalise all the content.

 Index
Data 
 stadium
West Ham 
 entrance
Bobby Moore 


Types of Smartwords

Using the custom_data table is just one example of how to use Smartwords. Smartwords can access:

  • data about your personas
  • data about your players
  • data about your exercise
  • data about your content
  • data about the Conducttr engine.


Data about your personas
Use the format {persona.persona_handle.attribute}
The available smarwords for personas are as follows (remember to replace handle with the persona's actual handle:

  • {persona.handle.name}
  • {persona.handle.handle}
  • {persona.handle.job}
  • {persona.handle.email}
  • {persona.handle.datebirth}
  • {persona.handle.gender}
  • {persona.handle.location}
  • {persona.handle.microblog.id}
  • {persona.handle.gosocial.id}
  • {persona.handle.mediablog.id}

Watch the video to see an example of persona smartwords in use.




Data about your players
For data about your players you can use the curly brackets: {}
Possible data available this way is:

  • {name}  for the player's name
You can also reference the name and email for 

  • {the_positions.position_name.name}
  • {the_positions.position_name.email}
So for example, if you have a position "Legal" and you want to print that person's name, you would write {the_positions.Legal.name}

Where you've used a calculation and data is stored in a variable, you can use:

  • {variable} where "variable" is replaced by the name of the variable (e.g. score)
  • {team.variable} will access a team variable
  • {session.variable} will access a session variable
Also see the section on data from the Conducttr Engine.


Data about your exercise
To access data in the custom_data table, always use the format:

  • {data.index} where "index" is replaced by your variable (e.g. "stadium" in the example above)


Data about your content
If you attach assets to content and it's to be published in a channel that supports it, you can specify where the assets should be embedded in the text. This is especially useful for emails, for example, where you can embed an image as a header or footer; or maybe you want an image embedded in the middle. For this, use:

  • {assets.1}  or {assets.2} where the number indicates the asset attached to the content.
For example:
Hey, checkout this pic!
{assets.1}
Amazing, huh?
Rob




Data from the Conducttr Engine


While the {} smartwords make life easier for commonly-used data, there's a lot more you can do by directly accessing the Conducttr Engine.

These smartwords use the || delimiters instead of {}.  Please note that you can't use the two together.

The rest of this article might get a bit complicated for some but even if you don't understand it completely, you might still be able to use the recipes. 


Audience Responses

To capture the player's response to the last question, you can use:

|audience.response|

Note that this only survives the immediate use after the question. If you want to store the response, you'll need to save it in a variable using a calculation

Arrays

Arrays are like tables with two columns: the left column is the index and the right column is the data.
The custom_data table is an array. In the example at the top of this article, the index "stadium" produces the value "West Ham".

If you're writing content to use the custom_data table, writing {data.stadium} is the easiest approach but you could also write |partition.custom_data["stadium"]| - they both mean the same.

Conducttr maintains the following arrays:

 Array
 Description
 custom_data
Holds the data you've added to personalise this scenario.
It can be accessed via Setup>Custom Data
 audience.responses
Holds all the question answers for a the current player.
The index is in the format campaign code.card number 

The campaign code can be configured by going to Setup>Essential configuration>Campaign code

Assuming a campaign code of "panda", then to get the player's response to the question asked on card 56, the smartword would be 
|audience.responses["panda.56"]|
 partition.decisions
Holds a count of players clicking on a data point (see the article on data points to understand what these are).

This is also indexed using the campaign code but it has two types of index:

  • campaign_code.card_number
  • campaign_code.card_number.choice
As an example, if the campaign code is "mr" and the card number is 3 and you want to know how many players have click the first choice, the smartword would be 

|partition.decisions["mr.3.1"]|

If you wanted to print this as a percentage you could write

|partition.decisions["mr.3.1"]| other person(s) took this decision which is |INT((partition.decisions["mr.3.1"]/partition.decisions["mr.3"])*100)|% of the total
 partition.variables
Holds the values of all the variables you've created in calculations.

To access a variable you're usually better off to use the {} notation but if you have to use || then this is how it looks...

the array holds three types of variable: audience, team and session. And these are identified in the index by a suffix - a. for audience, t. for team and s. for session.

To access the value of the variable, use
|partition.variables[CONCAT("{entity suffix}.",{entity it},".{variable name}")]|

The entity id for each entity is:

  • audience.hash
  • audience.participant_team_id
  • audience.session_id
So, putting this altogether, to access the audience attribute "my_score" the formula is |partition.variables[CONCAT("a.",audience.hash,".my_score")]| 

To access the team attribute "team_decision" the formula is 
|partition.variables[CONCAT("a.", audience.participant_team_id,".team_decision")]|
partition.the_chart_index
Holds the button text for any data point you create. The array is indexed by campaign_code.card_number.button_number 
In the image below, of he campaign code is "defsc" then
|partition.the_chart_index["defsc.3.1"]| = "stay INSIDE"







Using smartwords in calculations

You cannot use the {} notation in calculations.

Image Placeholder
This example saves the player's last response into the variable "player_age"


Nested Smartwords


Note that this is an advanced feature and not for the fainthearted ;)

Nested smartwords allows authors to create more dynamic experiences by using variables to access the data in other variables.

Example
Let's say you ask the player to choose a song and store the answer in a player variable called "music".
Normally to access this variable we would use {music}.

To nest the smartword you need to use the || notation. Hence the player variable "music" will become |partition.variables[CONCAT("a.",audience.hash,".music")]|


But lets say we want to use the the value in "music" to access some data in the custom data table. To do this we will use this expression:

|partition.custom_data[partition.variables[CONCAT("a.",audience.hash,".music")]]|