Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
6 changes: 3 additions & 3 deletions 6 integrations/Matomo/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ class Matomo {
const trimmedEvent = event.toLowerCase().trim();

// For every type of track calls we consider the trackGoal function.
if (goalListMap.has(trimmedEvent)) {
if (goalListMap[trimmedEvent]) {
goalIdMapping(trimmedEvent, goalListMap, message);
}

// Mapping Standard Events
if (standardEventsMap.has(trimmedEvent)) {
if (standardEventsMap[trimmedEvent]) {
standardEventsMapping(trimmedEvent, standardEventsMap, message);
}

Expand All @@ -204,4 +204,4 @@ class Matomo {
}
}

export default Matomo;
export default Matomo;
17 changes: 9 additions & 8 deletions 17 integrations/Matomo/util.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import each from "@ndhoule/each";
import logger from "../../utils/logUtil";
import { getHashFromArray } from "../utils/commonUtils";
import { NAME } from "./constants";
Expand All @@ -9,15 +10,15 @@ import { NAME } from "./constants";
*/
const goalIdMapping = (event, goalListMap, message) => {
let revenue;
if (message.properties) revenue = message.properties.revenue;
goalListMap.forEach((val, key) => {
revenue = message.properties?.revenue;
each((val, key) => {
if (key === event) {
val.forEach((v) => {
if (revenue) window._paq.push(["trackGoal", v, revenue]);
else window._paq.push(["trackGoal", v]);
});
}
});
}, goalListMap);
};

/** Mapping Standard Events
Expand All @@ -27,7 +28,7 @@ const goalIdMapping = (event, goalListMap, message) => {
@param {} message
*/
const standardEventsMapping = (event, standardEventsMap, message) => {
standardEventsMap.forEach((val, key) => {
each((val, key) => {
if (key === event) {
let url;
let linkType;
Expand Down Expand Up @@ -132,7 +133,7 @@ const standardEventsMapping = (event, standardEventsMap, message) => {
}
});
}
});
}, standardEventsMap);
};

/** Mapping Ecommerce Events
Expand Down Expand Up @@ -344,9 +345,9 @@ const checkCustomDimensions = (message) => {
"dimensionId",
"dimensionValue"
);
customDimensionsMap.forEach((val, key) => {
each((val, key) => {
window._paq.push(["setCustomDimension", key, val]);
});
}, customDimensionsMap);
}
}
};
Expand All @@ -356,4 +357,4 @@ export {
ecommerceEventsMapping,
standardEventsMapping,
checkCustomDimensions,
};
};
12 changes: 5 additions & 7 deletions 12 integrations/utils/commonUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,18 @@ const getHashFromArrayWithDuplicate = (
toKey = "to",
isLowerCase = true
) => {
const hashMap = new Map();
const hashMap = {};
if (Array.isArray(arrays)) {
arrays.forEach((array) => {
if (!isNotEmpty(array[fromKey])) return;
const key = isLowerCase
? array[fromKey].toLowerCase().trim()
: array[fromKey].trim();

if (hashMap.has(key)) {
const valueArray = hashMap.get(key);
valueArray.push(array[toKey]);
hashMap.set(key, valueArray);
if (hashMap[key]) {
hashMap[key].push(array[toKey]);
} else {
hashMap.set(key, [array[toKey]]);
hashMap[key]= [array[toKey]];
}
});
}
Expand Down Expand Up @@ -132,4 +130,4 @@ export {
isDefinedAndNotNullAndNotEmpty,
isBlank,
pick,
};
};
Morty Proxy This is a proxified and sanitized view of the page, visit original site.