diff --git a/optimizely/event_builder.py b/optimizely/event_builder.py index 2580d791..00b2c31d 100644 --- a/optimizely/event_builder.py +++ b/optimizely/event_builder.py @@ -215,7 +215,7 @@ def _add_required_params_for_conversion(self, event_key, event_tags, decisions): self.params[self.EventParams.EVENT_METRICS] = event_values - for event_tag_id in event_tags.keys(): + for event_tag_id in sorted(event_tags.keys()): event_tag_value = event_tags.get(event_tag_id) if event_tag_value is None: continue diff --git a/tests/test_optimizely.py b/tests/test_optimizely.py index db63c2b4..4c97c5b1 100644 --- a/tests/test_optimizely.py +++ b/tests/test_optimizely.py @@ -743,14 +743,14 @@ def test_track__with_invalid_event_tags(self): 'eventEntityId': '111095', 'eventName': 'test_event', 'eventFeatures': [{ - 'name': 'value', + 'name': 'revenue', 'type': 'custom', - 'value': '1.234', + 'value': '4200', 'shouldIndex': False, }, { - 'name': 'revenue', + 'name': 'value', 'type': 'custom', - 'value': '4200', + 'value': '1.234', 'shouldIndex': False, }], 'eventMetrics': [],