Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integrations/optimizely/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Optimizely.prototype.track = function(track) {
var payload = {
type: 'event',
eventName: eventName,
tags: eventProperties
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add testing details

properties: eventProperties
Comment on lines 113 to +116
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change switches the Optimizely Web track payload from tags to properties. The in-file docs indicate Classic consumes tags for revenue; if Classic support is still a requirement, consider sending both keys (or gating by snippet/API version) so existing Classic implementations don’t silently drop event metadata.

Copilot uses AI. Check for mistakes.
Comment on lines 112 to +116
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docblock for track still refers to sending event data as tags (and mentions Classic consuming a tags object), but the payload now uses properties. Please update the comment (and any in-file references) to match the new payload key to avoid misleading future maintenance.

Copilot uses AI. Check for mistakes.
};

push(payload);
Expand All @@ -132,7 +132,7 @@ Optimizely.prototype.track = function(track) {
eventName,
userId,
attributes,
payload.tags
payload.properties
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion integrations/optimizely/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@segment/analytics.js-integration-optimizely",
"description": "The Optimizely analytics.js integration.",
"version": "3.5.1",
"version": "3.5.2",
"keywords": [
"analytics.js",
"analytics.js-integration",
Expand Down
30 changes: 15 additions & 15 deletions integrations/optimizely/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Order Updated',
tags: {}
properties: {}
Comment on lines 541 to +549
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These test descriptions refer to the option name onlySendRevenueOnOrderCompleted, but the integration option is sendRevenueOnlyForOrderCompleted (as used throughout the file). Consider updating the wording here to the actual option name to prevent confusion when debugging test failures.

Copilot uses AI. Check for mistakes.
});
});

Expand All @@ -558,7 +558,7 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Order Completed',
tags: {
properties: {
revenue: 999
}
});
Expand All @@ -573,7 +573,7 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Checkout Started',
tags: {
properties: {
revenue: 999
}
});
Expand Down Expand Up @@ -830,7 +830,7 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Order Updated',
tags: {}
properties: {}
Comment on lines 825 to +833
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These test descriptions refer to the option name onlySendRevenueOnOrderCompleted, but the integration option is sendRevenueOnlyForOrderCompleted. Updating the wording here would keep the tests aligned with the implementation and reduce confusion.

Copilot uses AI. Check for mistakes.
});
});

Expand All @@ -843,7 +843,7 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Order Completed',
tags: {
properties: {
revenue: 999
}
});
Expand All @@ -858,7 +858,7 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Checkout Started',
tags: {
properties: {
revenue: 999
}
});
Expand Down Expand Up @@ -1075,7 +1075,7 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'event',
tags: {}
properties: {}
});
});

Expand All @@ -1084,25 +1084,25 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'event_foo_bar',
tags: {}
properties: {}
Comment on lines 1082 to +1087
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in test name: repacereplace. This makes the test output/readability clearer.

Copilot uses AI. Check for mistakes.
});
});

it('should send all additional properties along as tags', function() {
it('should send all additional properties along as properties', function() {
analytics.track('event', { id: 'c00lHa$h', name: 'jerry' });
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'event',
tags: { id: 'c00lHa$h', name: 'jerry' }
properties: { id: 'c00lHa$h', name: 'jerry' }
});
});

it('should change revenue to cents and include in tags', function() {
it('should change revenue to cents and include in properties', function() {
analytics.track('Order Completed', { revenue: 9.99 });
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Order Completed',
tags: { revenue: 999 }
properties: { revenue: 999 }
});
});

Expand All @@ -1111,7 +1111,7 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Order Completed',
tags: { revenue: 53431 }
properties: { revenue: 53431 }
});
});

Expand Down Expand Up @@ -1223,7 +1223,7 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Viewed Home Page',
tags: {
properties: {
name: 'Home',
path: '/context.html',
referrer: referrer,
Expand All @@ -1240,7 +1240,7 @@ describe('Optimizely', function() {
analytics.called(window.optimizely.push, {
type: 'event',
eventName: 'Viewed Blog New Integration Page',
tags: {
properties: {
name: 'New Integration',
category: 'Blog',
path: '/context.html',
Expand Down