11/**
2- * Copyright 2016-2017 , Optimizely
2+ * Copyright 2016-2018 , Optimizely
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -30,13 +30,14 @@ var HTTP_VERB = 'POST';
3030 * @param {string } options.clientVersion The version of the client
3131 * @param {Object } options.configObj Object representing project configuration, including datafile information and mappings for quick lookup
3232 * @param {string } options.userId ID for user
33+ * @param {Object } options.Logger logger
3334 * @return {Object } Common params with properties that are used in both conversion and impression events
3435 */
3536function getCommonEventParams ( options ) {
3637 var attributes = options . attributes ;
3738 var configObj = options . configObj ;
3839 var anonymize_ip = configObj . anonymizeIP ;
39-
40+ var botFiltering = configObj . botFiltering ;
4041 if ( anonymize_ip === null || anonymize_ip === undefined ) {
4142 anonymize_ip = false ;
4243 }
@@ -58,17 +59,25 @@ function getCommonEventParams(options) {
5859 } ;
5960
6061 fns . forOwn ( attributes , function ( attributeValue , attributeKey ) {
61- var attributeId = projectConfig . getAttributeId ( options . configObj , attributeKey ) ;
62+ var attributeId = projectConfig . getAttributeId ( options . configObj , attributeKey , options . logger ) ;
6263 if ( attributeId ) {
63- var feature = {
64+ commonParams . visitors [ 0 ] . attributes . push ( {
6465 entity_id : attributeId ,
6566 key : attributeKey ,
6667 type : CUSTOM_ATTRIBUTE_FEATURE_TYPE ,
6768 value : attributes [ attributeKey ] ,
68- } ;
69- commonParams . visitors [ 0 ] . attributes . push ( feature ) ;
69+ } ) ;
7070 }
7171 } ) ;
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+ } ;
7281 return commonParams ;
7382}
7483
0 commit comments