1
1
/**
2
- * Copyright 2016-2017 , Optimizely
2
+ * Copyright 2016-2018 , Optimizely
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -30,13 +30,14 @@ var HTTP_VERB = 'POST';
30
30
* @param {string } options.clientVersion The version of the client
31
31
* @param {Object } options.configObj Object representing project configuration, including datafile information and mappings for quick lookup
32
32
* @param {string } options.userId ID for user
33
+ * @param {Object } options.Logger logger
33
34
* @return {Object } Common params with properties that are used in both conversion and impression events
34
35
*/
35
36
function getCommonEventParams ( options ) {
36
37
var attributes = options . attributes ;
37
38
var configObj = options . configObj ;
38
39
var anonymize_ip = configObj . anonymizeIP ;
39
-
40
+ var botFiltering = configObj . botFiltering ;
40
41
if ( anonymize_ip === null || anonymize_ip === undefined ) {
41
42
anonymize_ip = false ;
42
43
}
@@ -58,17 +59,25 @@ function getCommonEventParams(options) {
58
59
} ;
59
60
60
61
fns . forOwn ( attributes , function ( attributeValue , attributeKey ) {
61
- var attributeId = projectConfig . getAttributeId ( options . configObj , attributeKey ) ;
62
+ var attributeId = projectConfig . getAttributeId ( options . configObj , attributeKey , options . logger ) ;
62
63
if ( attributeId ) {
63
- var feature = {
64
+ commonParams . visitors [ 0 ] . attributes . push ( {
64
65
entity_id : attributeId ,
65
66
key : attributeKey ,
66
67
type : CUSTOM_ATTRIBUTE_FEATURE_TYPE ,
67
68
value : attributes [ attributeKey ] ,
68
- } ;
69
- commonParams . visitors [ 0 ] . attributes . push ( feature ) ;
69
+ } ) ;
70
70
}
71
71
} ) ;
72
+
73
+ if ( typeof botFiltering === 'boolean' ) {
74
+ commonParams . visitors [ 0 ] . attributes . push ( {
75
+ entity_id : enums . CONTROL_ATTRIBUTES . BOT_FILTERING ,
76
+ key : enums . CONTROL_ATTRIBUTES . BOT_FILTERING ,
77
+ type : CUSTOM_ATTRIBUTE_FEATURE_TYPE ,
78
+ value : botFiltering ,
79
+ } ) ;
80
+ } ;
72
81
return commonParams ;
73
82
}
74
83
0 commit comments