Customization and Personalization Methods

With iridize you can set complex activation rules for your guides, based on individual end-user fields. For example, you may wish to automatically start an introductory guide for every new user once. Or you may want to make a guide available for a user two days after she have viewed a different guide. In order to be able to use such rules, you need to set some fields for your end-users, using the API.

api.fields.set

Set fields for the current end-user. This method expects a dictionary of one or more fields as the second argument. For example, the iridize embed code includes the following call (commented out) by default:

iridize("api.fields.set", {
user_id:"USER_ID_GOES_HERE",
joined_at:UNIXEPOCH_TIMESTAMP
});

where we set the reserved-name field "user_id", which can be any string uniquely identifying your end-users, such as a username, user ID or an email address. Here the field joined_at is a date field, set as a numeric unix epoch timestamp (in seconds) giving the time the user signed-up to the application.

NOTE: You must set the user_id in the very first call to api.fields.set on a page. Subsequent calls may omit this field, but it is considered best practice to always include it.

Setting user group/role: you may want to user this method to customize the experience of users based on group participation or user roles. This information could then be used to set up activation rules, such that members of different groups will have different guides available. An example for such call could be:

iridize("api.fields.set", {
    user_id:"simpsons@springfield.us",
    joined_at:629848800,
    role:"admin"
});

Time fields: to set a time field, simply name the field with an "_at" suffix. The time value should be provided using a unix epoch timestamp (in seconds). For example, to set the date a user joined the application, we could call:

iridize("api.fields.set", {
    user_id:"simpsons@springfield.us",
    joined_at:629848800,
});

Personalization and Dynamic Content

api.vars.set

Dynamically set page variables which can be used in guides content.

For example, you may want to address your end-users in your guides using their names. In such a case the call to api.vars.set could be:

iridize("api.vars.set", {"new user":"F. Bar"});

The variable can then be used in any guide that will be running on the page by enclosing the variable name ("new user") within double curly brackets ({{new user}}). When the guide is run and the step is displayed, the part enclosed within curly brackets will be replaced with the value of the page variable if it is set. If it is not set, the variable name will be used instead (without the curly brackets). A default value different than the variable name can be set using the pipe, "|", symbol. For example, the text of a welcoming step could be set to:

Hi {{user_name|there friend}}, thanks for signing up to fooBar. Let us show you around.

With the variable was set as described above, the text of this step will read "Welcome F. Bar, thanks for signing up to fooBar, let us show you around.". If the variable was not set, the text will open with "Hi there friend,..."

Another use case for this API call is for including dynamically generated hyperlinks in your guides text. For example, you may have in your application paths such as "/foo/username/bar/". If you would like to add a hyperlink to such a path within a guide you could simply set the link target to "/foo/{{username}}/bar/", and run "api.vars.set" as follows:

iridize("api.vars.set", {"username":"007"});

This will yield a hyperlink with the target "/foo/007/bar/".

If the var is not set, but a user field with the same name was set in an api.fields.set call, the value from the user field will be used. If both a var and a field with the same name are set the value of the var will be used.

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.