From bac4b031feea249d26d666b2df5d74d063103bea Mon Sep 17 00:00:00 2001
From: Eugen Neuber <eugen.neuber@tugraz.at>
Date: Wed, 23 Sep 2020 08:10:30 +0200
Subject: [PATCH] Read git commit from `buildInfo`

See issue #29 (comment in MR !2)
---
 packages/matomo/rollup.config.js | 1 +
 packages/matomo/src/matomo.js    | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/packages/matomo/rollup.config.js b/packages/matomo/rollup.config.js
index 39ad4839..6c05efb3 100644
--- a/packages/matomo/rollup.config.js
+++ b/packages/matomo/rollup.config.js
@@ -64,6 +64,7 @@ export default (async () => {
             }),
             consts({
                 environment: build,
+                buildInfo: getBuildInfo(),
             }),
             emitEJS({
                 src: 'assets',
diff --git a/packages/matomo/src/matomo.js b/packages/matomo/src/matomo.js
index 17d9b793..67f66d05 100644
--- a/packages/matomo/src/matomo.js
+++ b/packages/matomo/src/matomo.js
@@ -2,6 +2,7 @@ import {i18n} from './i18n.js';
 import {LitElement} from "lit-element";
 import DBPLitElement from 'dbp-common/dbp-lit-element';
 import {EventBus} from 'dbp-common';
+import buildInfo from 'consts:buildInfo';
 
 
 export class MatomoElement extends DBPLitElement {
@@ -53,7 +54,7 @@ export class MatomoElement extends DBPLitElement {
             console.log('add matomo...');
 
             window._paq = window._paq || [];
-            _paq.push(['setCustomVariable', 1, "GitCommit", "<%= buildInfo.info %>", "visit"]);
+            _paq.push(['setCustomVariable', 1, "GitCommit", buildInfo.info, "visit"]);
             _paq.push(['enableHeartBeatTimer']);
             _paq.push(['disableCookies']);
             _paq.push(['trackPageView']);
-- 
GitLab