lib/vwo/utils/impression.rb
def create_bulk_event_impression(settings_file, campaign_id, variation_id, user_id, goal_id = nil, revenue = nil)
        return unless valid_number?(campaign_id) && valid_string?(user_id)
        is_track_user_api = true
        is_track_user_api = false unless goal_id.nil?
        account_id = settings_file['accountId']
        impression = {
          eT: is_track_user_api ? 1 : 2,
          e: campaign_id,
          c: variation_id,
          u: generator_for(user_id, account_id),
          sId: get_current_unix_timestamp
        }
        logger = VWO::Logger.get_instance
        if is_track_user_api
          logger.log(
            LogLevelEnum::DEBUG,
            format(
              LogMessageEnum::DebugMessages::IMPRESSION_FOR_TRACK_USER,
              file: FileNameEnum::ImpressionUtil,
              properties: JSON.generate(impression)
            )
          )
        else
          impression['g'] = goal_id
          impression['r'] = revenue if revenue
          logger.log(
            LogLevelEnum::DEBUG,
            format(
              LogMessageEnum::DebugMessages::IMPRESSION_FOR_TRACK_GOAL,
              file: FileNameEnum::ImpressionUtil,
              properties: JSON.generate(impression)
            )
          )
        end
        impression
      end
# Creates properties for the bulk impression event
#
# @param[Hash]                        :settings_file          Settings file object
# @param[String]                      :campaign_id            Campaign identifier
# @param[String]                      :variation_id           Variation identifier
# @param[String]                      :user_id                User identifier
# @param[String]                      :sdk_key                SDK Key
# @param[String]                      :goal_id                Goal identifier, if building track impression
# @param[String|Float|Integer|nil)    :revenue                Number value, in any representation, if building track impression
#
# @return[nil|Hash]                                           None if campaign ID or variation ID is invalid,
#                                                             Else Properties(dict)
Creates properties for the bulk impression event
Creates properties for the bulk impression event
def create_bulk_event_impression(settings_file, campaign_id, variation_id, user_id, goal_id = nil, revenue = nil)
        return unless valid_number?(campaign_id) && valid_string?(user_id)
        is_track_user_api = true
        is_track_user_api = false unless goal_id.nil?
        account_id = settings_file['accountId']
        impression = {
          eT: is_track_user_api ? 1 : 2,
          e: campaign_id,
          c: variation_id,
          u: generator_for(user_id, account_id),
          sId: get_current_unix_timestamp
        }
        logger = VWO::Logger.get_instance
        if is_track_user_api
          logger.log(
            LogLevelEnum::DEBUG,
            format(
              LogMessageEnum::DebugMessages::IMPRESSION_FOR_TRACK_USER,
              file: FileNameEnum::ImpressionUtil,
              properties: JSON.generate(impression)
            )
          )
        else
          impression['g'] = goal_id
          impression['r'] = revenue if revenue
          logger.log(
            LogLevelEnum::DEBUG,
            format(
              LogMessageEnum::DebugMessages::IMPRESSION_FOR_TRACK_GOAL,
              file: FileNameEnum::ImpressionUtil,
              properties: JSON.generate(impression)
            )
          )
        end
        impression
      end
def create_bulk_event_impression ( settings_file , campaign_id , variation_id , user_id , goal_id = nil , revenue = nil ) return unless valid_number? ( campaign_id ) && valid_string? ( user_id ) is_track_user_api = true is_track_user_api = false unless goal_id . nil? account_id = settings_file [ 'accountId' ] impression = { eT : is_track_user_api ? 1 : 2 , e : campaign_id , c : variation_id , u : generator_for ( user_id , account_id ) , sId : get_current_unix_timestamp } logger = VWO :: Logger . get_instance if is_track_user_api logger . log ( LogLevelEnum :: DEBUG , format ( LogMessageEnum :: DebugMessages :: IMPRESSION_FOR_TRACK_USER , file : FileNameEnum :: ImpressionUtil , properties : JSON . generate ( impression ) ) ) else impression [ 'g' ] = goal_id impression [ 'r' ] = revenue if revenue logger . log ( LogLevelEnum :: DEBUG , format ( LogMessageEnum :: DebugMessages :: IMPRESSION_FOR_TRACK_GOAL , file : FileNameEnum :: ImpressionUtil , properties : JSON . generate ( impression ) ) ) end impression end
Creates properties for the bulk impression event
Creates properties for the bulk impression event
settings_file
campaign_id
variation_id
user_id
goal_id
revenue
param[Hash]
:settings_file Settings file object
: settings_file Settings file object
param[String]
:campaign_id Campaign identifier
: campaign_id Campaign identifier
param[String]
:variation_id Variation identifier
: variation_id Variation identifier
param[String]
:user_id User identifier
: user_id User identifier
param[String]
:sdk_key SDK Key
: sdk_key SDK Key
param[String]
:goal_id Goal identifier, if building track impression
: goal_id Goal identifier if building track impression
param[String|Float|Integer|nil)
:revenue Number value, in any representation, if building track impression
: revenue Number value in any representation if building track impression
return[nil|Hash]
None if campaign ID or variation ID is invalid, Else Properties(dict)
None if campaign ID or variation ID is invalid Else Properties ( dict )