-
Notifications
You must be signed in to change notification settings - Fork 0
Using Lytics segment API
dylo0 edited this page Jun 4, 2015
·
4 revisions
Instead of displaying widgets to all users, one can use targeted widgets which will be displayed only to a specific user group.
To do so, instead of widget array, one needs to add add ‘target’ object, in addition to Lytics ID.
In example below message1 will be displayed to new users (classified by Lytics as ‘smt_new’, and message2 will be visible for subscribers. Widgets inside ‘common’ array are visible by all users.
var message1 = new pathfora.Message({
msg: "Welcome to our site",
layout: 'modal'
});
var message2 = new pathfora.Message({
msg: "Nice to see you again",
layout: 'modal'
});
var message3 = new pathfora.Message({
msg: "This message is visible by all users",
layout: ‘bar’
});
var widgets = {
target: [{
segment: 'smt_new',
widgets: [message1]
},{
segment: 'subscriber',
widgets: [message2]
}
],
common: [message3]
};
var lyticsId = 1234;
window.pathfora.initializeWidgets(widgets, lyticsId);