Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
23 changes: 9 additions & 14 deletions src/Rokt-Kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var constructor = function () {
self.filters = {};
self.filteredUser = {};
self.userAttributes = {};
self.launcherOptions = {};
Comment thread
alexs-mparticle marked this conversation as resolved.
Outdated

/**
* Passes attributes to the Rokt Web SDK for client-side hashing
Expand All @@ -51,25 +52,19 @@ var constructor = function () {
testMode,
_trackerId,
filteredUserAttributes,
filteredUserIdentities,
appVersion,
appName,
customFlags
_filteredUserIdentities,
_appVersion,
_appName,
_customFlags
Comment thread
alexs-mparticle marked this conversation as resolved.
Outdated
) {
var accountId = settings.accountId;
self.userAttributes = filteredUserAttributes;
self.onboardingExpProvider = settings.onboardingExpProvider;

var integrationName =
customFlags && customFlags['Rokt.integrationName'];
var noFunctional = customFlags && customFlags['Rokt.noFunctional'];
var noTargeting = customFlags && customFlags['Rokt.noTargeting'];

var launcherOptions = {
integrationName: generateIntegrationName(integrationName),
noFunctional: noFunctional,
noTargeting: noTargeting,
};
var launcherOptions = self.launcherOptions || {};
launcherOptions.integrationName = generateIntegrationName(
launcherOptions.integrationName
);

if (testMode) {
attachLauncher(accountId, launcherOptions);
Expand Down
19 changes: 12 additions & 7 deletions test/src/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ describe('Rokt Forwarder', () => {

afterEach(() => {
window.mParticle.forwarder.userAttributes = {};
delete window.mParticle.forwarder.launcherOptions;
Comment thread
alexs-mparticle marked this conversation as resolved.
});

describe('#initForwarder', () => {
Expand Down Expand Up @@ -138,7 +139,13 @@ describe('Rokt Forwarder', () => {
window.Rokt.createLauncherCalled.should.equal(true);
});

it('should set optional settings from customFlags', async () => {
it('should set optional settings from launcherOptions', async () => {
mParticle.forwarder.launcherOptions = {
integrationName: 'customName',
noFunctional: true,
noTargeting: true,
};

await mParticle.forwarder.init(
{
accountId: '123456',
Expand All @@ -149,12 +156,7 @@ describe('Rokt Forwarder', () => {
{},
null,
null,
null,
{
'Rokt.integrationName': 'customName',
'Rokt.noFunctional': true,
'Rokt.noTargeting': true,
}
null
);

var expectedIntegrationName =
Expand Down Expand Up @@ -255,6 +257,9 @@ describe('Rokt Forwarder', () => {
window.mParticle.Rokt.attachKitCalled = true;
return Promise.resolve();
};
mParticle.forwarder.launcherOptions = {
integrationName: customIntegrationName,
};

// Simulate the forwarder appending the custom integration name
window.Rokt.integrationName =
Expand Down