May 13, 2015 · Connecto Feature

Dynamic Variables - Customize your notification by dynamic content

This is in follow up to our post on custom variables targeting which lets you target notifications by any rules or logic defined within your notifications.

Problem:

What if you want to populate the content within your notification by the custom variable present on the page. A common use case that arises is if you know the user's name and in your notification, you want to greet him by that name. How do you do that with Connecto ?

Solution:

To solve this problem, we support Dynamic Variables that can be setup in two easy steps:

1. Send Dynamic Variables and Values to Connecto from the page

If you have read our previous post, this is the same way you define custom variables. So custom variables are nothing but dynamic variables.

var _TConnecto = _TConnecto || {};
_TConnecto.licenseKey = 'YOUR_LICENSE_KEY';
_TConnecto.initConnecto = function() {
    _TConnecto.addVariable("signedUpForCourseA", "yes");
    _TConnecto.addVariable("signedUpInLastWeek", "yes");
};
...

2. Turn on dynamic content for the notification

Within your Edit Notification -> Edit Visuals -> Advanced Options -> Other Options, you can turn on Dynamic Variable(s) like these

Dynamic Variables in Create/Edit Screen

3. Use dynamic variables in Notification Text

Without dynamic variables

_TConnecto.initConnecto = function() {
    _TConnecto.addVariable("name", "Dave");
};

and change your notification content to use the variable name.

Dynamic variable in text

And voila, your notification is now personalized.

Dynamic variable in content

Not only this you can have variables present in any of the theme variables like 'Target URL', 'Form fields' etc.

How does it work and what all is possible ?

We want to thank the guys at Mustache to make it possible. Essentially you can do everything with your dynamic variables that you can do with Mustache.

Conditional replacement

Fallback

_TConnecto.addVariable('message', ['May', 'the', 'force', 'be', 'with', 'you']);

You can use mustache to enlist the elements.

Enlisting

will render to

Array enlisted

And thats it folks. Hope you find this blog post useful and you use our dynamic variables feature.

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket
-