Skip to content

Commit

Permalink
Merge pull request #239 from gbmhunter/develop
Browse files Browse the repository at this point in the history
Release of v3.5.4.
  • Loading branch information
gbmhunter authored Mar 31, 2024
2 parents 4ee6567 + ac01db6 commit 72662b9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## [v3.5.4](https://github.com/gbmhunter/NinjaCalc/tree/v3.5.4) (2024-03-31)

* Added Umami analytics script.

## [v3.5.3](https://github.com/gbmhunter/NinjaCalc/tree/v3.5.3) (2024-01-10)

* Fixed incorrect URL to the NinjaCalc app from the homepage.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ninja-calc",
"version": "3.5.2",
"version": "3.5.4",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
3 changes: 3 additions & 0 deletions pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ class MyDocument extends Document {
}}
/>

{/* Umami analytics. Tracking is disabled in dev. by setting
umami.disabled in local storage to 1. */}
<script defer src="https://umami.mbedded.ninja/script.js" data-website-id="f08a945e-6251-481c-bb7c-3275e76b2efc"></script>

</Head>
<body>
Expand Down
12 changes: 11 additions & 1 deletion pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,17 @@ class Home extends React.Component {
this.addCalc(CalcMovingAverageFilterDesigner)
}

componentDidMount = () => {}
componentDidMount = () => {
// Enable Umami analytics script in production and disable
// in dev. environment. Use the umami.disabled key in local storage for doing so
if (process.env.NODE_ENV === 'production') {
// It's not good enough just to set the key to 0, it needs to be removed
window.localStorage.removeItem('umami.disabled');
} else {
console.log('Detected dev. environment, setting umami.disabled in local storage to "1".');
window.localStorage.setItem('umami.disabled', '1');
}
}

addCalc = (calcModule) => {
let calculators = this.state.calculators
Expand Down

0 comments on commit 72662b9

Please sign in to comment.