Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
var _ = global.get('lodash');
var  tv_series=  ['Bones', 'Psych', 'Big Bang Theory', 'Mad Men', 'Breaking Bad', 'Modern Family', 'Game of Thrones', 'Dexter'];

rndnum = Math.floor(Math.random() * 8);

msg.analytics.attributes = {
    'str': `this is a string`, 
    'const': 2,
    'bool': true,
    'mycontextData': {
        'series_name': tv_series[rndnum],
        'value': `value__${_.sample(tv_series)}`
    },
};
return msg;

Sample screenshot after adding the function node to the Experience Designer.

...

For every agent type(flow, answer), there will be a separate schema. The properties id, name, contextData are available for each agent type by default. The contextData object contains other properties such as state, faq, and so on.

...