Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Pinterest.prototype.getPinterestEvent = function(segmentEvent) {
for (var mappedEvent in this.options.pinterestEventMapping) {
if (mappedEvent.toLowerCase() === segmentEvent.toLowerCase()) {
return this.options.pinterestEventMapping[mappedEvent];
}
}
var eventMap = [
// Segment Inbound Event (Regex) -> Pinterest Outbound Event
[analyticsEvents.productsSearched, 'Search'],
[analyticsEvents.productListFiltered, 'Search'],
[analyticsEvents.productAdded, 'AddToCart'],
[analyticsEvents.orderCompleted, 'Checkout'],
[analyticsEvents.videoPlaybackStarted, 'WatchVideo']
];
for (var index in eventMap) {
if (!eventMap.hasOwnProperty(index)) continue;
var eventRegex = eventMap[index][0];
var pinterestEvent = eventMap[index][1];
if (eventRegex.test(segmentEvent)) {
return pinterestEvent;
}
}
};
Pinterest.prototype.getPinterestEvent = function(segmentEvent) {
for (var mappedEvent in this.options.pinterestEventMapping) {
if (mappedEvent.toLowerCase() === segmentEvent.toLowerCase()) {
return this.options.pinterestEventMapping[mappedEvent];
}
}
var eventMap = [
// Segment Inbound Event (Regex) -> Pinterest Outbound Event
[analyticsEvents.productsSearched, 'Search'],
[analyticsEvents.productListFiltered, 'Search'],
[analyticsEvents.productAdded, 'AddToCart'],
[analyticsEvents.orderCompleted, 'Checkout'],
[analyticsEvents.videoPlaybackStarted, 'WatchVideo']
];
for (var index in eventMap) {
if (!eventMap.hasOwnProperty(index)) continue;
var eventRegex = eventMap[index][0];
var pinterestEvent = eventMap[index][1];
if (eventRegex.test(segmentEvent)) {
return pinterestEvent;
}
}
};
Pinterest.prototype.getPinterestEvent = function(segmentEvent) {
for (var mappedEvent in this.options.pinterestEventMapping) {
if (mappedEvent.toLowerCase() === segmentEvent.toLowerCase()) {
return this.options.pinterestEventMapping[mappedEvent];
}
}
var eventMap = [
// Segment Inbound Event (Regex) -> Pinterest Outbound Event
[analyticsEvents.productsSearched, 'Search'],
[analyticsEvents.productListFiltered, 'Search'],
[analyticsEvents.productAdded, 'AddToCart'],
[analyticsEvents.orderCompleted, 'Checkout'],
[analyticsEvents.videoPlaybackStarted, 'WatchVideo']
];
for (var index in eventMap) {
if (!eventMap.hasOwnProperty(index)) continue;
var eventRegex = eventMap[index][0];
var pinterestEvent = eventMap[index][1];
if (eventRegex.test(segmentEvent)) {
return pinterestEvent;
}
}
};
Pinterest.prototype.getPinterestEvent = function(segmentEvent) {
for (var mappedEvent in this.options.pinterestEventMapping) {
if (mappedEvent.toLowerCase() === segmentEvent.toLowerCase()) {
return this.options.pinterestEventMapping[mappedEvent];
}
}
var eventMap = [
// Segment Inbound Event (Regex) -> Pinterest Outbound Event
[analyticsEvents.productsSearched, 'Search'],
[analyticsEvents.productListFiltered, 'Search'],
[analyticsEvents.productAdded, 'AddToCart'],
[analyticsEvents.orderCompleted, 'Checkout'],
[analyticsEvents.videoPlaybackStarted, 'WatchVideo']
];
for (var index in eventMap) {
if (!eventMap.hasOwnProperty(index)) continue;
var eventRegex = eventMap[index][0];
var pinterestEvent = eventMap[index][1];
if (eventRegex.test(segmentEvent)) {
return pinterestEvent;
}
}
};
Pinterest.prototype.getPinterestEvent = function(segmentEvent) {
for (var mappedEvent in this.options.pinterestEventMapping) {
if (mappedEvent.toLowerCase() === segmentEvent.toLowerCase()) {
return this.options.pinterestEventMapping[mappedEvent];
}
}
var eventMap = [
// Segment Inbound Event (Regex) -> Pinterest Outbound Event
[analyticsEvents.productsSearched, 'Search'],
[analyticsEvents.productListFiltered, 'Search'],
[analyticsEvents.productAdded, 'AddToCart'],
[analyticsEvents.orderCompleted, 'Checkout'],
[analyticsEvents.videoPlaybackStarted, 'WatchVideo']
];
for (var index in eventMap) {
if (!eventMap.hasOwnProperty(index)) continue;
var eventRegex = eventMap[index][0];
var pinterestEvent = eventMap[index][1];
if (eventRegex.test(segmentEvent)) {
return pinterestEvent;
}
}
};