packages/optimizely-sdk/lib/core/event_builder/index.js
function getCommonEventParams(options) {
  var attributes = options.attributes;
  var configObj = options.configObj;
  var anonymize_ip = configObj.anonymizeIP;
  var botFiltering = configObj.botFiltering;
  if (anonymize_ip === null || anonymize_ip === undefined) {
    anonymize_ip = false;
  }

  var visitor = {
    snapshots: [],
    visitor_id: options.userId,
    attributes: []
  };

  var commonParams = {
    account_id: configObj.accountId,
    project_id: configObj.projectId,
    visitors: [visitor],
    revision: configObj.revision,
    client_name: options.clientEngine,
    client_version: options.clientVersion,
    anonymize_ip: anonymize_ip,
    enrich_decisions: true,
  };

  // Omit attribute values that are not supported by the log endpoint.
  fns.forOwn(attributes, function(attributeValue, attributeKey) {
    if (attributeValidator.isAttributeValid(attributeKey, attributeValue)) {
      var attributeId = projectConfig.getAttributeId(options.configObj, attributeKey, options.logger);
      if (attributeId) {
        commonParams.visitors[0].attributes.push({
          entity_id: attributeId,
          key: attributeKey,
          type: CUSTOM_ATTRIBUTE_FEATURE_TYPE,
          value: attributes[attributeKey],
        });
      }
    }
  });

  if (typeof botFiltering === 'boolean') {
    commonParams.visitors[0].attributes.push({
      entity_id: enums.CONTROL_ATTRIBUTES.BOT_FILTERING,
      key: enums.CONTROL_ATTRIBUTES.BOT_FILTERING,
      type: CUSTOM_ATTRIBUTE_FEATURE_TYPE,
      value: botFiltering,
    });
  }
  return commonParams;
}
function getCommonEventParams(options) {
  var attributes = options.attributes;
  var configObj = options.configObj;
  var anonymize_ip = configObj.anonymizeIP;
  var botFiltering = configObj.botFiltering;
  if (anonymize_ip === null || anonymize_ip === undefined) {
    anonymize_ip = false;
  }

  var visitor = {
    snapshots: [],
    visitor_id: options.userId,
    attributes: []
  };

  var commonParams = {
    account_id: configObj.accountId,
    project_id: configObj.projectId,
    visitors: [visitor],
    revision: configObj.revision,
    client_name: options.clientEngine,
    client_version: options.clientVersion,
    anonymize_ip: anonymize_ip,
    enrich_decisions: true,
  };

  // Omit attribute values that are not supported by the log endpoint.
  fns.forOwn(attributes, function(attributeValue, attributeKey) {
    if (attributeValidator.isAttributeValid(attributeKey, attributeValue)) {
      var attributeId = projectConfig.getAttributeId(options.configObj, attributeKey, options.logger);
      if (attributeId) {
        commonParams.visitors[0].attributes.push({
          entity_id: attributeId,
          key: attributeKey,
          type: CUSTOM_ATTRIBUTE_FEATURE_TYPE,
          value: attributes[attributeKey],
        });
      }
    }
  });

  if (typeof botFiltering === 'boolean') {
    commonParams.visitors[0].attributes.push({
      entity_id: enums.CONTROL_ATTRIBUTES.BOT_FILTERING,
      key: enums.CONTROL_ATTRIBUTES.BOT_FILTERING,
      type: CUSTOM_ATTRIBUTE_FEATURE_TYPE,
      value: botFiltering,
    });
  }
  return commonParams;
}
function getCommonEventParams ( options ) { var attributes = options . attributes ; var configObj = options . configObj ; var anonymize_ip = configObj . anonymizeIP ; var botFiltering = configObj . botFiltering ; if ( anonymize_ip === null || anonymize_ip === undefined ) { anonymize_ip = false ; } var visitor = { snapshots : [ ] , visitor_id : options . userId , attributes : [ ] } ; var commonParams = { account_id : configObj . accountId , project_id : configObj . projectId , visitors : [ visitor ] , revision : configObj . revision , client_name : options . clientEngine , client_version : options . clientVersion , anonymize_ip : anonymize_ip , enrich_decisions : true , } ; // Omit attribute values that are not supported by the log endpoint. fns . forOwn ( attributes , function ( attributeValue , attributeKey ) { if ( attributeValidator . isAttributeValid ( attributeKey , attributeValue ) ) { var attributeId = projectConfig . getAttributeId ( options . configObj , attributeKey , options . logger ) ; if ( attributeId ) { commonParams . visitors [ 0 ] . attributes . push ( { entity_id : attributeId , key : attributeKey , type : CUSTOM_ATTRIBUTE_FEATURE_TYPE , value : attributes [ attributeKey ] , } ) ; } } } ) ; if ( typeof botFiltering === 'boolean' ) { commonParams . visitors [ 0 ] . attributes . push ( { entity_id : enums . CONTROL_ATTRIBUTES . BOT_FILTERING , key : enums . CONTROL_ATTRIBUTES . BOT_FILTERING , type : CUSTOM_ATTRIBUTE_FEATURE_TYPE , value : botFiltering , } ) ; } return commonParams ; }
Get params which are used same in both conversion and impression events
@param  {Object} options.attributes    Object representing user attributes and values which need to be recorded
@param  {string} options.clientEngine  The client we are using: node or javascript
@param  {string} options.clientVersion The version of the client
@param  {Object} options.configObj     Object representing project configuration, including datafile information and mappings for quick lookup
@param  {string} options.userId        ID for user
@param  {Object} options.Logger        logger
@return {Object}                       Common params with properties that are used in both conversion and impression events
Get params which are used same in both conversion and impression events