Skip to content

Commit

Permalink
fix: uuid for matomo uid (#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudambro authored Jul 5, 2024
1 parent 98fb2fd commit ea2cc70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
11 changes: 3 additions & 8 deletions api/src/third-parties/matomo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// https://developer.matomo.org/api-reference/tracking-api
const fetch = require("node-fetch");
const { MATOMO_URL, MATOMO_IDSITE_1 } = require("../config");
const { v4: uuid } = require("uuid");
const { capture } = require("./sentry");

const __DEV__ = process.env.NODE_ENV === "development";
Expand All @@ -13,14 +14,8 @@ class _MatomoBackend {
this.initDone = true;
}

makeid(length = 16) {
var result = "";
var characters = "01234567890abcdefABCDEF";
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
makeid() {
return uuid();
}

setCustomDimensions(newDimensions) {
Expand Down
11 changes: 3 additions & 8 deletions app/src/services/matomo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// https://developer.matomo.org/api-reference/tracking-api
import { v4 as uuid } from 'uuid';

class _Matomo {
init({ baseUrl, idsite, userId, _idvc }) {
Expand All @@ -14,14 +15,8 @@ class _Matomo {
this.idsite2 = idsite;
}

makeid(length = 16) {
var result = '';
var characters = '01234567890abcdefABCDEF';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
makeid() {
return uuid();
}

setCustomDimensions(newDimensions) {
Expand Down

0 comments on commit ea2cc70

Please sign in to comment.