JavaScript

Method Description

Implemented in tracker with an identify call with additional fields. Operation name and input fields can be set up via Maestra framework.

maestra('identify', {
        operation: '<operation name>',
        identificator: {
                provider: 'WebSiteUserId',
                identity: '<customer ID>'
        },
        data: {
          lastName: '<customer last name>',
          firstName: '<customer first name>',
          mobilePhone: '<customer mobile number>',
          email: '<customer email>',
          <custom field>: '<custom field value>',
          order:{
            webSiteId: '<order ID>',
            <custom order field>: '<custom field value>',
            price: <orderPrice>,
            items: [
            { 
              productId: '<product ID>',
              quantity: <product quantity>,
              price: <price per product item, discount included> 
            },
            { 
              productId: '<product ID>',
              quantity: <product quantity>,
              price: <price per product item, discount included> 
            }]
          },
          subscriptions: [
          {
            pointOfContact: '<communication channel, email/SMS/etc.>',
            topic: '<emailing topic>',
            isSubscribed: <subscription status, true/false>,
            valueByDefault: <subscription default value, true/false> 
          }]
        },
        success: function() {},
        error: function(error) {}
});

Sample Operations

maestra('identify', {
       operation: 'CreateOrder',
       identificator: {
               provider: 'BitrixId',
               identity: '346257'
       },
       data: {              
         mobilePhone: '5552368',
         fullName: 'John Smith',
         email: '[email protected]',
         city: 'Austin',
         b2b: true,
         order:{
           webSiteId: '4123A',
           price: 350,
           items: [
             { 
               productId: '34234-534-E', 
               quantity: 1, 
               price: 50 
             },
             { 
               productId: '34432-753-A', 
               quantity: 2, 
               price: 150 
             }
           ]
         },
         subscriptions: [
           {
             pointOfContact: 'Sms',
             topic: 'SweetsOfLife',
             isSubscribed: false,
             valueByDefault: true
           },
           {
             pointOfContact: 'Email',
             topic: 'NewGossips',
             isSubscribed: true,
             valueByDefault: true
           }]
       },
       success: function() {
         alert("Order processed");
       },
       error: function(error) {
         console.log(error);
       }
});