Skip to content

Commit 3272ea4

Browse files
feat: Expose Rokt launcher config options
1 parent b45f257 commit 3272ea4

2 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/Rokt-Kit.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var constructor = function () {
2929
self.filters = {};
3030
self.filteredUser = {};
3131
self.userAttributes = {};
32+
self.launcherOptions = {};
3233

3334
/**
3435
* Passes attributes to the Rokt Web SDK for client-side hashing
@@ -51,25 +52,19 @@ var constructor = function () {
5152
testMode,
5253
_trackerId,
5354
filteredUserAttributes,
54-
filteredUserIdentities,
55-
appVersion,
56-
appName,
57-
customFlags
55+
_filteredUserIdentities,
56+
_appVersion,
57+
_appName,
58+
_customFlags
5859
) {
5960
var accountId = settings.accountId;
6061
self.userAttributes = filteredUserAttributes;
6162
self.onboardingExpProvider = settings.onboardingExpProvider;
6263

63-
var integrationName =
64-
customFlags && customFlags['Rokt.integrationName'];
65-
var noFunctional = customFlags && customFlags['Rokt.noFunctional'];
66-
var noTargeting = customFlags && customFlags['Rokt.noTargeting'];
67-
68-
var launcherOptions = {
69-
integrationName: generateIntegrationName(integrationName),
70-
noFunctional: noFunctional,
71-
noTargeting: noTargeting,
72-
};
64+
var launcherOptions = self.launcherOptions || {};
65+
launcherOptions.integrationName = generateIntegrationName(
66+
launcherOptions.integrationName
67+
);
7368

7469
if (testMode) {
7570
attachLauncher(accountId, launcherOptions);

test/src/tests.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ describe('Rokt Forwarder', () => {
9898

9999
afterEach(() => {
100100
window.mParticle.forwarder.userAttributes = {};
101+
delete window.mParticle.forwarder.launcherOptions;
101102
});
102103

103104
describe('#initForwarder', () => {
@@ -138,7 +139,13 @@ describe('Rokt Forwarder', () => {
138139
window.Rokt.createLauncherCalled.should.equal(true);
139140
});
140141

141-
it('should set optional settings from customFlags', async () => {
142+
it('should set optional settings from launcherOptions', async () => {
143+
mParticle.forwarder.launcherOptions = {
144+
integrationName: 'customName',
145+
noFunctional: true,
146+
noTargeting: true,
147+
};
148+
142149
await mParticle.forwarder.init(
143150
{
144151
accountId: '123456',
@@ -149,12 +156,7 @@ describe('Rokt Forwarder', () => {
149156
{},
150157
null,
151158
null,
152-
null,
153-
{
154-
'Rokt.integrationName': 'customName',
155-
'Rokt.noFunctional': true,
156-
'Rokt.noTargeting': true,
157-
}
159+
null
158160
);
159161

160162
var expectedIntegrationName =
@@ -255,6 +257,9 @@ describe('Rokt Forwarder', () => {
255257
window.mParticle.Rokt.attachKitCalled = true;
256258
return Promise.resolve();
257259
};
260+
mParticle.forwarder.launcherOptions = {
261+
integrationName: customIntegrationName,
262+
};
258263

259264
// Simulate the forwarder appending the custom integration name
260265
window.Rokt.integrationName =

0 commit comments

Comments
 (0)