You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maciek Jurczyk edited this page Feb 17, 2016
·
4 revisions
Using Lytics segment API
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.
Widgets inside inverse are visible to any users who are not a member of smt_new or subscribers.
varmessage1=newpathfora.Message({msg: 'Welcome to our site',layout: 'modal'});varmessage2=newpathfora.Message({msg: 'Nice to see you again',layout: 'modal'});varmessage3=newpathfora.Message({msg: 'This message is visible by all users',layout: 'modal'});varmessage4=newpathfora.Message({msg: 'This message is visible by users who are not a part of either segment',layout: 'bar'});varmessage5=newpathfora.Message({msg: 'This message is visible by all users',layout: 'bar'});varwidgets={target: [{segment: 'smt_new',widgets: [message1]},{segment: 'subscribers',widgets: [message2]},{segment: '*',// Wildcard segment allows all users to see the widgetwidgets: [message3]}],inverse: [message4],common: [message5]};varlyticsId='1234';pathfora.initializeWidgets(widgets,lyticsId);