Skip to content

Commit c9422a9

Browse files
Changed the reserved keyword (#56)
* Changed the reserved keyword and added comments to explain potential future changes. * Fixed the bucketing ID reserved name.
1 parent 823ebcb commit c9422a9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Optimizely/DecisionService/DecisionService.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@
2929
use Optimizely\UserProfile\UserProfileUtils;
3030
use Optimizely\Utils\Validator;
3131

32-
define("RESERVED_ATTRIBUTE_KEY_BUCKETING_ID", "Optimizely Bucketing ID");
32+
// This value was decided between App Backend, Audience, and Oasis teams, but may possibly change.
33+
// We decided to prefix the reserved keyword with '$' because it is a symbol that is not
34+
// allowed in custom attributes.
35+
// We also thought that the prefix 'opt' makes it apparent to users that the variable belongs to Optimizely.
36+
define("RESERVED_ATTRIBUTE_KEY_BUCKETING_ID", "\$opt_bucketing_id");
3337

3438
/**
3539
* Optimizely's decision service that determines which variation of an experiment the user will be allocated to.

src/Optimizely/Event/Builder/EventBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ private function setCommonParams($config, $userId, $attributes)
106106
if ($attributeValue) {
107107
// check for reserved attributes
108108
if (strcmp($attributeKey , RESERVED_ATTRIBUTE_KEY_BUCKETING_ID) == 0) {
109+
// TODO (Alda): the type for bucketing ID attribute may change so that custom
110+
// attributes are not overloaded
109111
array_push($this->_eventParams[USER_FEATURES], [
110112
'name' => RESERVED_ATTRIBUTE_KEY_BUCKETING_ID_EVENT_PARAM_KEY,
111113
'type' => 'custom',

0 commit comments

Comments
 (0)