vwo-sdk 1.6.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/vwo/constants.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2020 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2021 Wingify Software Pvt. Ltd.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -26,20 +26,29 @@ class VWO
26
26
  HTTP_PROTOCOL = 'http://'
27
27
  HTTPS_PROTOCOL = 'https://'
28
28
  URL_NAMESPACE = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'
29
- SDK_VERSION = '1.6.0'
29
+ SDK_VERSION = '1.14.0'
30
30
  SDK_NAME = 'ruby'
31
+ VWO_DELIMITER = '_vwo_'
32
+ MAX_EVENTS_PER_REQUEST = 5000
33
+ MIN_EVENTS_PER_REQUEST = 1
34
+ DEFAULT_EVENTS_PER_REQUEST = 100
35
+ DEFAULT_REQUEST_TIME_INTERVAL = 600 # 10 * 60(secs) = 600 secs i.e. 10 minutes
36
+ MIN_REQUEST_TIME_INTERVAL = 2
31
37
 
32
38
  module ENDPOINTS
33
39
  BASE_URL = 'dev.visualwebsiteoptimizer.com'
34
- ACCOUNT_SETTINGS = '/server-side/settings'
40
+ SETTINGS_URL = '/server-side/settings'
41
+ WEBHOOK_SETTINGS_URL = '/server-side/pull'
35
42
  TRACK_USER = '/server-side/track-user'
36
43
  TRACK_GOAL = '/server-side/track-goal'
37
44
  PUSH = '/server-side/push'
45
+ BATCH_EVENTS = '/server-side/batch-events'
38
46
  end
39
47
 
40
48
  module EVENTS
41
49
  TRACK_USER = 'track-user'
42
50
  TRACK_GOAL = 'track-goal'
51
+ PUSH = 'push'
43
52
  end
44
53
 
45
54
  module DATATYPE
@@ -61,6 +70,12 @@ class VWO
61
70
  BOOLEAN = 'boolean'
62
71
  end
63
72
 
73
+ module Hooks
74
+ DECISION_TYPES = {
75
+ 'CAMPAIGN_DECISION' => 'CAMPAIGN_DECISION'
76
+ }
77
+ end
78
+
64
79
  RUBY_VARIABLE_TYPES = {
65
80
  'string' => [String],
66
81
  'integer' => [Integer],
@@ -68,6 +83,12 @@ class VWO
68
83
  'boolean' => [TrueClass, FalseClass]
69
84
  }
70
85
 
86
+ GOAL_TYPES = {
87
+ 'REVENUE' => 'REVENUE_TRACKING',
88
+ 'CUSTOM' => 'CUSTOM_GOAL',
89
+ 'ALL' => 'ALL'
90
+ }
91
+
71
92
  module ApiMethods
72
93
  ACTIVATE = 'activate'
73
94
  GET_VARIATION_NAME = 'get_variation_name'
@@ -75,6 +96,8 @@ class VWO
75
96
  IS_FEATURE_ENABLED = 'is_feature_enabled'
76
97
  GET_FEATURE_VARIABLE_VALUE = 'get_feature_variable_value'
77
98
  PUSH = 'push'
99
+ GET_AND_UPDATE_SETTINGS_FILE = 'get_and_update_settings_file'
100
+ FLUSH_EVENTS = 'flush_events'
78
101
  end
79
102
 
80
103
  module PushApi
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2020 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2021 Wingify Software Pvt. Ltd.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2020 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2021 Wingify Software Pvt. Ltd.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -18,15 +18,20 @@ require_relative '../utils/campaign'
18
18
  require_relative '../services/segment_evaluator'
19
19
  require_relative '../utils/validations'
20
20
  require_relative 'bucketer'
21
+ require_relative '../constants'
22
+ require_relative '../services/hooks_manager'
23
+ require_relative '../utils/uuid'
21
24
 
22
25
  class VWO
23
26
  module Core
24
27
  class VariationDecider
25
- attr_reader :user_storage_service
28
+ attr_reader :user_storage_service, :has_stored_variation, :hooks_manager
26
29
 
27
30
  include VWO::Enums
28
31
  include VWO::Utils::Campaign
29
32
  include VWO::Utils::Validations
33
+ include VWO::CONSTANTS
34
+ include VWO::Utils::UUID
30
35
 
31
36
  FILE = FileNameEnum::VariationDecider
32
37
 
@@ -34,12 +39,13 @@ class VWO
34
39
  # @param[Hash] - Settings file
35
40
  # @param[Class] - Class instance having the capability of
36
41
  # get and save.
37
- def initialize(settings_file, user_storage_service = nil)
42
+ def initialize(settings_file, user_storage_service = nil, options = {})
38
43
  @logger = VWO::Logger.get_instance
39
44
  @user_storage_service = user_storage_service
40
45
  @bucketer = VWO::Core::Bucketer.new
41
46
  @settings_file = settings_file
42
47
  @segment_evaluator = VWO::Services::SegmentEvaluator.new
48
+ @hooks_manager = VWO::Services::HooksManager.new(options)
43
49
  end
44
50
 
45
51
  # Returns variation for the user for the passed campaign-key
@@ -51,14 +57,42 @@ class VWO
51
57
  # @param[String] :user_id The unique ID assigned to User
52
58
  # @param[Hash] :campaign Campaign hash itself
53
59
  # @param[String] :campaign_key The unique ID of the campaign passed
60
+ # @param[String] :goal_identifier The unique campaign's goal identifier
54
61
  # @return[String,String] ({variation_id, variation_name}|Nil): Tuple of
55
62
  # variation_id and variation_name if variation allotted, else nil
56
63
 
57
- def get_variation(user_id, campaign, api_name, campaign_key, custom_variables = {}, variation_targeting_variables = {})
64
+ def get_variation(user_id, campaign, api_name, campaign_key, custom_variables = {}, variation_targeting_variables = {}, goal_identifier = '')
58
65
  campaign_key ||= campaign['key']
59
66
 
60
67
  return unless campaign
61
68
 
69
+ @has_stored_variation = false
70
+ decision = {
71
+ :campaign_id => campaign['id'],
72
+ :campaign_key => campaign_key,
73
+ :campaign_type => campaign['type'],
74
+ # campaign segmentation conditions
75
+ :custom_variables => custom_variables,
76
+ # event name
77
+ :event => Hooks::DECISION_TYPES['CAMPAIGN_DECISION'],
78
+ # goal tracked in case of track API
79
+ :goal_identifier => goal_identifier,
80
+ # campaign whitelisting flag
81
+ :is_forced_variation_enabled => campaign['isForcedVariationEnabled'] ? campaign['isForcedVariationEnabled'] : false,
82
+ :sdk_version => SDK_VERSION,
83
+ # API name which triggered the event
84
+ :source => api_name,
85
+ # Passed in API
86
+ :user_id => user_id,
87
+ # Campaign Whitelisting conditions
88
+ :variation_targeting_variables => variation_targeting_variables,
89
+ :is_user_whitelisted => false,
90
+ :from_user_storage_service => false,
91
+ :is_feature_enabled => true,
92
+ # VWO generated UUID based on passed UserId and Account ID
93
+ :vwo_user_id => generator_for(user_id, @settings_file['accountId'])
94
+ }
95
+
62
96
  if campaign['isForcedVariationEnabled']
63
97
  variation = evaluate_whitelisting(
64
98
  user_id,
@@ -88,6 +122,19 @@ class VWO
88
122
  )
89
123
  )
90
124
 
125
+ if variation
126
+ if campaign['type'] == CampaignTypes::VISUAL_AB || campaign['type'] == CampaignTypes::FEATURE_TEST
127
+ decision[:variation_name] = variation['name']
128
+ decision[:variation_id] = variation['id']
129
+ if campaign['type'] == CampaignTypes::FEATURE_TEST
130
+ decision[:is_feature_enabled] = variation['isFeatureEnabled']
131
+ elsif campaign['type'] == CampaignTypes::VISUAL_AB
132
+ decision[:is_user_whitelisted] = !!variation['name']
133
+ end
134
+ end
135
+ @hooks_manager.execute(decision)
136
+ end
137
+
91
138
  return variation if variation && variation['name']
92
139
  else
93
140
  @logger.log(
@@ -104,8 +151,13 @@ class VWO
104
151
 
105
152
  user_campaign_map = get_user_storage(user_id, campaign_key)
106
153
  variation = get_stored_variation(user_id, campaign_key, user_campaign_map) if valid_hash?(user_campaign_map)
154
+ variation = variation.dup # deep copy
107
155
 
108
156
  if variation
157
+ if valid_string?(user_campaign_map['goal_identifier']) && api_name == ApiMethods::TRACK
158
+ variation['goal_identifier'] = user_campaign_map['goal_identifier']
159
+ end
160
+ @has_stored_variation = true
109
161
  @logger.log(
110
162
  LogLevelEnum::INFO,
111
163
  format(
@@ -116,7 +168,55 @@ class VWO
116
168
  variation_name: variation['name']
117
169
  )
118
170
  )
171
+ decision[:from_user_storage_service] = !!variation['name']
172
+ if variation
173
+ if campaign['type'] == CampaignTypes::VISUAL_AB || campaign['type'] == CampaignTypes::FEATURE_TEST
174
+ decision[:variation_name] = variation['name']
175
+ decision[:variation_id] = variation['id']
176
+ if campaign['type'] == CampaignTypes::FEATURE_TEST
177
+ decision[:is_feature_enabled] = variation['isFeatureEnabled']
178
+ end
179
+ end
180
+ @hooks_manager.execute(decision)
181
+ end
119
182
  return variation
183
+ else
184
+ @logger.log(
185
+ LogLevelEnum::DEBUG,
186
+ format(
187
+ LogMessageEnum::DebugMessages::NO_STORED_VARIATION,
188
+ file: FILE,
189
+ campaign_key: campaign_key,
190
+ user_id: user_id
191
+ )
192
+ )
193
+
194
+ if ([ApiMethods::TRACK, ApiMethods::GET_VARIATION_NAME, ApiMethods::GET_FEATURE_VARIABLE_VALUE].include? api_name) &&
195
+ @user_storage_service && campaign['type'] != CampaignTypes::FEATURE_ROLLOUT
196
+ @logger.log(
197
+ LogLevelEnum::DEBUG,
198
+ format(
199
+ LogMessageEnum::DebugMessages::CAMPAIGN_NOT_ACTIVATED,
200
+ file: FILE,
201
+ campaign_key: campaign_key,
202
+ user_id: user_id,
203
+ api_name: api_name
204
+ )
205
+ )
206
+
207
+ @logger.log(
208
+ LogLevelEnum::INFO,
209
+ format(
210
+ LogMessageEnum::InfoMessages::CAMPAIGN_NOT_ACTIVATED,
211
+ file: FILE,
212
+ campaign_key: campaign_key,
213
+ user_id: user_id,
214
+ api_name: api_name,
215
+ reason: api_name == ApiMethods::TRACK ? 'track it' : 'get the decision/value'
216
+ )
217
+ )
218
+ return
219
+ end
120
220
  end
121
221
 
122
222
  # Pre-segmentation
@@ -178,7 +278,7 @@ class VWO
178
278
  variation = get_variation_allotted(user_id, campaign)
179
279
 
180
280
  if variation && variation['name']
181
- save_user_storage(user_id, campaign_key, variation['name']) if variation['name']
281
+ save_user_storage(user_id, campaign_key, variation['name'], goal_identifier) if variation['name']
182
282
 
183
283
  @logger.log(
184
284
  LogLevelEnum::INFO,
@@ -197,6 +297,17 @@ class VWO
197
297
  format(LogMessageEnum::InfoMessages::NO_VARIATION_ALLOCATED, file: FILE, campaign_key: campaign_key, user_id: user_id)
198
298
  )
199
299
  end
300
+
301
+ if variation
302
+ if campaign['type'] == CampaignTypes::VISUAL_AB || campaign['type'] == CampaignTypes::FEATURE_TEST
303
+ decision[:variation_name] = variation['name']
304
+ decision[:variation_id] = variation['id']
305
+ if campaign['type'] == CampaignTypes::FEATURE_TEST
306
+ decision[:is_feature_enabled] = variation['isFeatureEnabled']
307
+ end
308
+ end
309
+ @hooks_manager.execute(decision)
310
+ end
200
311
  variation
201
312
  end
202
313
 
@@ -293,6 +404,45 @@ class VWO
293
404
  nil
294
405
  end
295
406
 
407
+ # If UserStorageService is provided, save the assigned variation
408
+ #
409
+ # @param[String] :user_id Unique user identifier
410
+ # @param[String] :campaign_key Unique campaign identifier
411
+ # @param[String] :variation_name Variation identifier
412
+ # @param[String] :goal_identifier The unique campaign's goal identifier
413
+ # @return[Boolean] true if found otherwise false
414
+
415
+ def save_user_storage(user_id, campaign_key, variation_name, goal_identifier)
416
+ unless @user_storage_service
417
+ @logger.log(
418
+ LogLevelEnum::DEBUG,
419
+ format(LogMessageEnum::DebugMessages::NO_USER_STORAGE_SERVICE_SAVE, file: FILE)
420
+ )
421
+ return false
422
+ end
423
+ new_campaign_user_mapping = {}
424
+ new_campaign_user_mapping['campaign_key'] = campaign_key
425
+ new_campaign_user_mapping['user_id'] = user_id
426
+ new_campaign_user_mapping['variation_name'] = variation_name
427
+ if !goal_identifier.empty?
428
+ new_campaign_user_mapping['goal_identifier'] = goal_identifier
429
+ end
430
+
431
+ @user_storage_service.set(new_campaign_user_mapping)
432
+
433
+ @logger.log(
434
+ LogLevelEnum::INFO,
435
+ format(LogMessageEnum::InfoMessages::SAVING_DATA_USER_STORAGE_SERVICE, file: FILE, user_id: user_id)
436
+ )
437
+ true
438
+ rescue StandardError
439
+ @logger.log(
440
+ LogLevelEnum::ERROR,
441
+ format(LogMessageEnum::ErrorMessages::SAVE_USER_STORAGE_SERVICE_FAILED, file: FILE, user_id: user_id)
442
+ )
443
+ false
444
+ end
445
+
296
446
  private
297
447
 
298
448
  # Evaluate all the variations in the campaign to find
@@ -464,41 +614,6 @@ class VWO
464
614
  variation_name
465
615
  )
466
616
  end
467
-
468
- # If UserStorageService is provided, save the assigned variation
469
- #
470
- # @param[String] :user_id Unique user identifier
471
- # @param[String] :campaign_key Unique campaign identifier
472
- # @param[String] :variation_name Variation identifier
473
- # @return[Boolean] true if found otherwise false
474
-
475
- def save_user_storage(user_id, campaign_key, variation_name)
476
- unless @user_storage_service
477
- @logger.log(
478
- LogLevelEnum::DEBUG,
479
- format(LogMessageEnum::DebugMessages::NO_USER_STORAGE_SERVICE_SAVE, file: FILE)
480
- )
481
- return false
482
- end
483
- new_campaign_user_mapping = {}
484
- new_campaign_user_mapping['campaign_key'] = campaign_key
485
- new_campaign_user_mapping['user_id'] = user_id
486
- new_campaign_user_mapping['variation_name'] = variation_name
487
-
488
- @user_storage_service.set(new_campaign_user_mapping)
489
-
490
- @logger.log(
491
- LogLevelEnum::INFO,
492
- format(LogMessageEnum::InfoMessages::SAVING_DATA_USER_STORAGE_SERVICE, file: FILE, user_id: user_id)
493
- )
494
- true
495
- rescue StandardError
496
- @logger.log(
497
- LogLevelEnum::ERROR,
498
- format(LogMessageEnum::ErrorMessages::SAVE_USER_STORAGE_SERVICE_FAILED, file: FILE, user_id: user_id)
499
- )
500
- false
501
- end
502
617
  end
503
618
  end
504
619
  end
data/lib/vwo/enums.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2020 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2021 Wingify Software Pvt. Ltd.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -71,6 +71,8 @@ class VWO
71
71
  SegmentEvaluator = VWO_PATH + '/services/segment_evaluator'
72
72
  Logger = VWO_PATH + '/logger'
73
73
  SettingsFileProcessor = VWO_PATH + '/services/settings_file_processor'
74
+ BatchEventsQueue = VWO_PATH + '/services/batch_events_queue'
75
+ BatchEventsDispatcher = VWO_PATH + '/services/batch_events_dispatcher'
74
76
 
75
77
  CampaignUtil = UTIL_PATH + '/campaign'
76
78
  FunctionUtil = UTIL_PATH + '/function'
@@ -106,6 +108,11 @@ class VWO
106
108
  GOT_VARIATION_FOR_USER = '(%<file>s): userId:%<user_id>s for campaign:%<campaign_key>s got variationName:%<variation_name>s'
107
109
  SEGMENTATION_STATUS = '(%<file>s): In API: %<api_name>s, for UserId:%<user_id>s of campaign:%<campaign_key>s with variables:%<custom_variables>s %<status>s %<segmentation_type>s for %<variation_name>s'
108
110
  PARAMS_FOR_PUSH_CALL = '(%<file>s): Params for push call - %<properties>s'
111
+ CAMPAIGN_NOT_ACTIVATED = '(%<file>s): Campaign:%<campaign_key>s for User ID:%<user_id>s is not yet activated for API:%<api_name>s. Use activate API to activate A/B test or isFeatureEnabled API to activate Feature Test.'
112
+ BATCH_EVENT_LIMIT_EXCEEDED = '(%<file>s): Impression event - %<end_point>s failed due to exceeding payload size. Parameter eventsPerRequest in batchEvents config in launch API has value:%<eventsPerRequest>s for accountId:%<accountId>s. Please read the official documentation for knowing the size limits.'
113
+ BULK_NOT_PROCESSED = "(%<file>s): Batch events couldn't be received by VWO. Calling Flush Callback with error and data."
114
+ BEFORE_FLUSHING = '(%<file>s): Flushing events queue %<manually>s having %<length>s events %<timer>s queue summary: %<queue_metadata>s'
115
+ EVENT_BATCHING_INSUFFICIENT = '(%<file>s): %<key>s not provided, assigning default value'
109
116
  end
110
117
 
111
118
  # Info Messages
@@ -120,9 +127,9 @@ class VWO
120
127
  AUDIENCE_CONDITION_NOT_MET = '(%<file>s): userId:%<user_id>s does not become part of campaign because of not meeting audience conditions'
121
128
  GOT_VARIATION_FOR_USER = '(%<file>s): userId:%<user_id>s for campaign:%<campaign_key>s got variationName:%<variation_name>s'
122
129
  USER_GOT_NO_VARIATION = '(%<file>s): userId:%<user_id>s for campaign:%<campaign_key>s did not allot any variation'
123
- IMPRESSION_SUCCESS = '(%<file>s): Impression event - %<end_point>s was successfully received by VWO having main keys: accountId:%<account_id>s userId:%<user_id>s campaignId:%<campaign_id>s and variationId:%<variation_id>s'
124
- MAIN_KEYS_FOR_IMPRESSION = '(%<file>s): Having main keys: accountId:%<account_id>s} userId:%<user_id>s campaignId:%<campaign_id>s and variationId:%<variation_id>s'
125
- MAIN_KEYS_FOR_PUSH_API = '(%<file>s): Having main keys: accountId:%<account_id>s} userId:%<user_id>s u:%<u>s and tags:%<tags>s}'
130
+ IMPRESSION_SUCCESS = '(%<file>s): Impression event - %<end_point>s was successfully received by VWO having main keys: sdkKey:%<sdk_key>s accountId:%<account_id>s campaignId:%<campaign_id>s and variationId:%<variation_id>s'
131
+ MAIN_KEYS_FOR_IMPRESSION = '(%<file>s): Having main keys: {sdkKey:%<sdk_key>s accountId:%<account_id>s campaignId:%<campaign_id>s and variationId:%<variation_id>s}'
132
+ MAIN_KEYS_FOR_PUSH_API = '(%<file>s): Having main keys: {sdkKey:%<sdk_key>s accountId:%<account_id>s u:%<u>s and tags:%<tags>s}'
126
133
  INVALID_VARIATION_KEY = '(%<file>s): Variation was not assigned to userId:%<user_id>s for campaign:%<campaign_key>s'
127
134
 
128
135
  USER_IN_FEATURE_ROLLOUT = '(%<file>s): User ID:%<user_id>s is in feature rollout:%<campaign_key>s'
@@ -140,6 +147,14 @@ class VWO
140
147
 
141
148
  SEGMENTATION_STATUS = '(%<file>s): In API: %<api_name>s, for UserId:%<user_id>s of campaign:%<campaign_key>s with variables:%<custom_variables>s %<status>s %<segmentation_type>s %<variation_name>s'
142
149
  WHITELISTING_SKIPPED = '(%<file>s): In API: %<api_name>s, Skipping whitelisting for UserId:%<user_id>s of campaign:%<campaign_key>s'
150
+ SETTINGS_NOT_UPDATED = '(%<file>s): Settings-file fetched are same as earlier fetched settings'
151
+ SETTINGS_FILE_UPDATED = '(%<file>s): %<api_name>s vwo_sdk_instance is updated with the latest settings_file'
152
+ CAMPAIGN_NOT_ACTIVATED = '(%<file>s): Activate the campaign:%<campaign_key>s for User ID:%<user_id>s to %<reason>s.'
153
+ GOAL_ALREADY_TRACKED = '(%<file>s): Goal:%<goal_identifier>s of Campaign:%<campaign_key>s for User ID:%<user_id>s has already been tracked earlier. Skipping now'
154
+ USER_ALREADY_TRACKED = '(%<file>s): User ID:%<user_id>s for Campaign:%<campaign_key>s has already been tracked earlier for "%<api_name>s" API. Skipping now'
155
+ API_CALLED = '(%<file>s): API: {api_name} called for UserId:%<user_id>s'
156
+ BULK_IMPRESSION_SUCCESS = '(%<file>s): Impression event - %<end_point>s was successfully received by VWO having accountId:%<a>s'
157
+ AFTER_FLUSHING = '(%<file>s): Events queue having %<length>s events has been flushed %<manually>s queue summary: %<queue_metadata>s'
143
158
  end
144
159
 
145
160
  # Warning Messages
@@ -152,7 +167,7 @@ class VWO
152
167
  API_CONFIG_CORRUPTED = '(%<file>s): %<api_name>s API has corrupted configuration'
153
168
  GET_VARIATION_NAME_API_INVALID_PARAMS = '(%<file>s): %<api_name>s API got bad parameters. It expects campaignTestKey(String) as first and userId(String) as second argument, customVariables(Hash) can be passed via options for pre-segmentation'
154
169
  GET_VARIATION_API_CONFIG_CORRUPTED = '(%<file>s): "getVariation" API has corrupted configuration'
155
- TRACK_API_INVALID_PARAMS = '(%<file>s): %<api_name>s API got bad parameters. It expects campaignTestKey(String) as first userId(String) as second and goalIdentifier(String/Number) as third argument. Fourth is revenueValue(Float/Number/String) and is required for revenue goal only. customVariables(Hash) can be passed via options for pre-segmentation'
170
+ TRACK_API_INVALID_PARAMS = '(%<file>s): %<api_name>s API got bad parameters. It expects campaignTestKey(Nil/String/Array) as first userId(String) as second and goalIdentifier(String/Number) as third argument. Fourth is revenueValue(Float/Number/String) and is required for revenue goal only. customVariables(Hash) can be passed via options for pre-segmentation'
156
171
  TRACK_API_CONFIG_CORRUPTED = '(%<file>s): "track" API has corrupted configuration'
157
172
  TRACK_API_GOAL_NOT_FOUND = '(%<file>s): Goal:%<goal_identifier>s not found for campaign:%<campaign_key>s and userId:%<user_id>s'
158
173
  TRACK_API_REVENUE_NOT_PASSED_FOR_REVENUE_GOAL = '(%<file>s): Revenue value should be passed for revenue goal:%<goal_identifier>s for campaign:%<campaign_key>s and userId:%<user_id>s'
@@ -179,6 +194,16 @@ class VWO
179
194
  PUSH_API_INVALID_PARAMS = '(%<file>s): %<api_name>s API got bad parameters. It expects tag_key(String) as first and tag_value(String) as second argument and user_id(String) as third argument'
180
195
  TAG_VALUE_LENGTH_EXCEEDED = '(%<file>s): In API: %<api_name>s, the length of tag_value:%<tag_value>s and userID: %<user_id>s can not be greater than 255'
181
196
  TAG_KEY_LENGTH_EXCEEDED = '(%<file>s): In API: %<api_name>s, the length of tag_key:%<tag_key>s and userID: %<user_id>s can not be greater than 255'
197
+ TRACK_API_MISSING_PARAMS = '(%<file>s): "track" API got bad parameters. It expects campaignKey(null/String/array) as first, userId(String/Number) as second and goalIdentifier (string) as third argument. options is revenueValue(Float/Number/String) and is required for revenue goal only.'
198
+ NO_CAMPAIGN_FOUND = '(%<file>s): No campaign found for goal_identifier:%<goal_identifier>s. Please verify from VWO app.'
199
+ INVALID_TRACK_RETURNING_USER_VALUE = '(%<file>s): should_track_returning_user should be boolean'
200
+ INVALID_GOAL_TYPE = '(%<file>s): goal_type_to_track should be certain strings'
201
+ EVENT_BATCHING_NOT_OBJECT = '(%<file>s): Batch events settings are not of type object.'
202
+ EVENTS_PER_REQUEST_INVALID = '(%<file>s): events_per_request should be an integer'
203
+ REQUEST_TIME_INTERVAL_INVALID = '(%<file>s): request_time_interval should be a number'
204
+ EVENTS_PER_REQUEST_OUT_OF_BOUNDS = '(%<file>s): events_per_request should be >= %<min_value>s and <= %<max_value>s'
205
+ REQUEST_TIME_INTERVAL_OUT_OF_BOUNDS = '(%<file>s): request_time_interval should be >= %<min_value>s'
206
+ FLUSH_CALLBACK_INVALID = '(%<file>s): flush_callback is not callable'
182
207
  end
183
208
  end
184
209
 
data/lib/vwo/logger.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2019-2020 Wingify Software Pvt. Ltd.
1
+ # Copyright 2019-2021 Wingify Software Pvt. Ltd.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.