Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
25 changes: 23 additions & 2 deletions dist/Rokt-Kit.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var constructor = function () {
self.placementEventMappingLookup = {};
self.placementEventAttributeMappingLookup = {};
self.eventQueue = [];
self.preloadEventMappingLookup = {};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mattbodle Please remove the dist files from your PR

self.integrationName = null;

function getEventAttributeValue(event, eventAttributeKey) {
Expand Down Expand Up @@ -242,6 +243,12 @@ var constructor = function () {
self.placementEventAttributeMappingLookup =
generateMappedEventAttributeLookup(placementEventAttributeMapping);

var preloadEventMapping = parseSettingsString(
settings.preloadEventMapping
);
self.preloadEventMappingLookup =
generateMappedEventLookup(preloadEventMapping);

// Set dynamic OTHER_IDENTITY based on server settings
// Convert to lowercase since server sends TitleCase (e.g., 'Other' -> 'other')
if (settings.hashedEmailUserIdentityType) {
Expand Down Expand Up @@ -328,7 +335,8 @@ var constructor = function () {
}
if (
isEmpty(self.placementEventMappingLookup) &&
isEmpty(self.placementEventAttributeMappingLookup)
isEmpty(self.placementEventAttributeMappingLookup) &&
isEmpty(self.preloadEventMappingLookup)
) {
return {};
}
Expand Down Expand Up @@ -497,7 +505,10 @@ var constructor = function () {
applyPlacementEventAttributeMapping(event);
}

if (isEmpty(self.placementEventMappingLookup)) {
if (
isEmpty(self.placementEventMappingLookup) &&
isEmpty(self.preloadEventMappingLookup)
) {
return;
}

Expand All @@ -511,6 +522,16 @@ var constructor = function () {
var mappedValue = self.placementEventMappingLookup[hashedEvent];
window.mParticle.Rokt.setLocalSessionAttribute(mappedValue, true);
}

if (self.preloadEventMappingLookup[hashedEvent]) {
var preloadIdentifier =
self.preloadEventMappingLookup[hashedEvent];
selectPlacements({
preload: true,
identifier: preloadIdentifier,
attributes: event.EventAttributes || {},
});
}
}

function onUserIdentified(filteredUser) {
Expand Down
25 changes: 23 additions & 2 deletions dist/Rokt-Kit.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var RoktKit = (function (exports) {
self.placementEventMappingLookup = {};
self.placementEventAttributeMappingLookup = {};
self.eventQueue = [];
self.preloadEventMappingLookup = {};
self.integrationName = null;

function getEventAttributeValue(event, eventAttributeKey) {
Expand Down Expand Up @@ -241,6 +242,12 @@ var RoktKit = (function (exports) {
self.placementEventAttributeMappingLookup =
generateMappedEventAttributeLookup(placementEventAttributeMapping);

var preloadEventMapping = parseSettingsString(
settings.preloadEventMapping
);
self.preloadEventMappingLookup =
generateMappedEventLookup(preloadEventMapping);

// Set dynamic OTHER_IDENTITY based on server settings
// Convert to lowercase since server sends TitleCase (e.g., 'Other' -> 'other')
if (settings.hashedEmailUserIdentityType) {
Expand Down Expand Up @@ -327,7 +334,8 @@ var RoktKit = (function (exports) {
}
if (
isEmpty(self.placementEventMappingLookup) &&
isEmpty(self.placementEventAttributeMappingLookup)
isEmpty(self.placementEventAttributeMappingLookup) &&
isEmpty(self.preloadEventMappingLookup)
) {
return {};
}
Expand Down Expand Up @@ -496,7 +504,10 @@ var RoktKit = (function (exports) {
applyPlacementEventAttributeMapping(event);
}

if (isEmpty(self.placementEventMappingLookup)) {
if (
isEmpty(self.placementEventMappingLookup) &&
isEmpty(self.preloadEventMappingLookup)
) {
return;
}

Expand All @@ -510,6 +521,16 @@ var RoktKit = (function (exports) {
var mappedValue = self.placementEventMappingLookup[hashedEvent];
window.mParticle.Rokt.setLocalSessionAttribute(mappedValue, true);
}

if (self.preloadEventMappingLookup[hashedEvent]) {
var preloadIdentifier =
self.preloadEventMappingLookup[hashedEvent];
selectPlacements({
preload: true,
identifier: preloadIdentifier,
attributes: event.EventAttributes || {},
});
}
}

function onUserIdentified(filteredUser) {
Expand Down
25 changes: 23 additions & 2 deletions src/Rokt-Kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
self.placementEventMappingLookup = {};
self.placementEventAttributeMappingLookup = {};
self.eventQueue = [];
self.preloadEventMappingLookup = {};
self.integrationName = null;

function getEventAttributeValue(event, eventAttributeKey) {
Expand Down Expand Up @@ -238,6 +239,12 @@
self.placementEventAttributeMappingLookup =
generateMappedEventAttributeLookup(placementEventAttributeMapping);

var preloadEventMapping = parseSettingsString(
settings.preloadEventMapping
);
self.preloadEventMappingLookup =
generateMappedEventLookup(preloadEventMapping);

// Set dynamic OTHER_IDENTITY based on server settings
// Convert to lowercase since server sends TitleCase (e.g., 'Other' -> 'other')
if (settings.hashedEmailUserIdentityType) {
Expand Down Expand Up @@ -324,7 +331,8 @@
}
if (
isEmpty(self.placementEventMappingLookup) &&
isEmpty(self.placementEventAttributeMappingLookup)
isEmpty(self.placementEventAttributeMappingLookup) &&
isEmpty(self.preloadEventMappingLookup)
) {
return {};
}
Expand Down Expand Up @@ -493,7 +501,10 @@
applyPlacementEventAttributeMapping(event);
}

if (isEmpty(self.placementEventMappingLookup)) {
if (
isEmpty(self.placementEventMappingLookup) &&
isEmpty(self.preloadEventMappingLookup)
) {
return;
}

Expand All @@ -507,6 +518,16 @@
var mappedValue = self.placementEventMappingLookup[hashedEvent];
window.mParticle.Rokt.setLocalSessionAttribute(mappedValue, true);
}

if (self.preloadEventMappingLookup[hashedEvent]) {
var preloadIdentifier =

Check failure on line 523 in src/Rokt-Kit.js

View workflow job for this annotation

GitHub Actions / Run Web Kit PR Workflow / Build and Test

Delete `⏎···············`
self.preloadEventMappingLookup[hashedEvent];
selectPlacements({
preload: true,
identifier: preloadIdentifier,
attributes: event.EventAttributes || {},
});
}
}

function onUserIdentified(filteredUser) {
Expand Down
Loading
Loading