switch posthog for matomo
This commit is contained in:
parent
dc4176c47a
commit
09838c900a
@ -1,17 +1,10 @@
|
|||||||
import "./src/styles/global.css";
|
import "./src/styles/global.css";
|
||||||
import posthog from "posthog-js";
|
|
||||||
|
|
||||||
const env =
|
const env =
|
||||||
process.env.GATSBY_ACTIVE_ENV || process.env.NODE_ENV || "development";
|
process.env.GATSBY_ACTIVE_ENV || process.env.NODE_ENV || "development";
|
||||||
if (env === "production") {
|
|
||||||
posthog.init("HR8Gte105aCHNx2BqhL1XkbvH9kzKGptxjkbhuTj6Ek", {
|
|
||||||
api_host: "https://posthog.chuckdries.com",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
export const onRouteUpdate = function () {
|
export const onRouteUpdate = function () {
|
||||||
if (env === "production" && typeof window.plausible === "object") {
|
if (env === "production" && typeof window.plausible === "object") {
|
||||||
window.plausible("pageview");
|
window.plausible("pageview");
|
||||||
posthog.capture("$pageview");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// import * as React from 'react';
|
// import * as React from 'react';
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
"node-vibrant": "3.1.6",
|
"node-vibrant": "3.1.6",
|
||||||
"postcss": "^8.3.4",
|
"postcss": "^8.3.4",
|
||||||
"postcss-nested": "^5.0.5",
|
"postcss-nested": "^5.0.5",
|
||||||
"posthog-js": "^1.11.3",
|
|
||||||
"ramda": "^0.27.1",
|
"ramda": "^0.27.1",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
|
@ -12,13 +12,11 @@ import {
|
|||||||
import { GatsbyImage, getImage } from "gatsby-plugin-image";
|
import { GatsbyImage, getImage } from "gatsby-plugin-image";
|
||||||
import { Helmet } from "react-helmet";
|
import { Helmet } from "react-helmet";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import posthog from "posthog-js";
|
|
||||||
import MetadataItem from "./MetadataItem";
|
import MetadataItem from "./MetadataItem";
|
||||||
|
|
||||||
const logKeyShortcut = (keyCode) => {
|
const logKeyShortcut = (keyCode) => {
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
posthog.capture("[key shortcut]", { keyCode });
|
|
||||||
window.plausible("KeyShortcut", { props: { keyCode } });
|
window.plausible("KeyShortcut", { props: { keyCode } });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
|
17
src/html.js
17
src/html.js
@ -31,6 +31,23 @@ export default function HTML(props) {
|
|||||||
{env === "production" && (
|
{env === "production" && (
|
||||||
<script>{`window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }`}</script>
|
<script>{`window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }`}</script>
|
||||||
)}
|
)}
|
||||||
|
{false && (
|
||||||
|
<script type="text/javascript">
|
||||||
|
{`
|
||||||
|
var _paq = window._paq = window._paq || [];
|
||||||
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||||
|
_paq.push(['trackPageView']);
|
||||||
|
_paq.push(['enableLinkTracking']);
|
||||||
|
(function() {
|
||||||
|
var u="//matomo.chuckdries.com/";
|
||||||
|
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
||||||
|
_paq.push(['setSiteId', '1']);
|
||||||
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||||
|
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
||||||
|
})();
|
||||||
|
`}
|
||||||
|
</script>
|
||||||
|
)}
|
||||||
</head>
|
</head>
|
||||||
<body {...props.bodyAttributes}>
|
<body {...props.bodyAttributes}>
|
||||||
{props.preBodyComponents}
|
{props.preBodyComponents}
|
||||||
|
@ -4,7 +4,6 @@ import { GatsbyImage, getImage } from "gatsby-plugin-image";
|
|||||||
import { Helmet } from "react-helmet";
|
import { Helmet } from "react-helmet";
|
||||||
import { take } from "ramda";
|
import { take } from "ramda";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import posthog from "posthog-js";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getVibrantToHelmetSafeBodyStyle,
|
getVibrantToHelmetSafeBodyStyle,
|
||||||
@ -137,9 +136,6 @@ const IndexPage = ({
|
|||||||
JSON.parse(localStorage.getItem("lastHeros")) || [];
|
JSON.parse(localStorage.getItem("lastHeros")) || [];
|
||||||
if (env === "production") {
|
if (env === "production") {
|
||||||
try {
|
try {
|
||||||
posthog.capture("[shuffle image]", {
|
|
||||||
currentImage: currentImage?.base,
|
|
||||||
});
|
|
||||||
window.plausible("Shuffle", {
|
window.plausible("Shuffle", {
|
||||||
props: { currentImage: currentImage?.base },
|
props: { currentImage: currentImage?.base },
|
||||||
});
|
});
|
||||||
|
12
yarn.lock
12
yarn.lock
@ -5897,11 +5897,6 @@ fd@~0.0.2:
|
|||||||
resolved "https://registry.yarnpkg.com/fd/-/fd-0.0.3.tgz#b3240de86dbf5a345baae7382a07d4713566ff0c"
|
resolved "https://registry.yarnpkg.com/fd/-/fd-0.0.3.tgz#b3240de86dbf5a345baae7382a07d4713566ff0c"
|
||||||
integrity sha512-iAHrIslQb3U68OcMSP0kkNWabp7sSN6d2TBSb2JO3gcLJVDd4owr/hKM4SFJovFOUeeXeItjYgouEDTMWiVAnA==
|
integrity sha512-iAHrIslQb3U68OcMSP0kkNWabp7sSN6d2TBSb2JO3gcLJVDd4owr/hKM4SFJovFOUeeXeItjYgouEDTMWiVAnA==
|
||||||
|
|
||||||
fflate@^0.4.1:
|
|
||||||
version "0.4.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.4.8.tgz#f90b82aefbd8ac174213abb338bd7ef848f0f5ae"
|
|
||||||
integrity sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==
|
|
||||||
|
|
||||||
figures@^1.3.5:
|
figures@^1.3.5:
|
||||||
version "1.7.0"
|
version "1.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e"
|
resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e"
|
||||||
@ -11033,13 +11028,6 @@ postcss@^8.2.15, postcss@^8.2.9:
|
|||||||
nanoid "^3.1.23"
|
nanoid "^3.1.23"
|
||||||
source-map-js "^0.6.2"
|
source-map-js "^0.6.2"
|
||||||
|
|
||||||
posthog-js@^1.11.3:
|
|
||||||
version "1.11.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.11.3.tgz#52e0b9265f22505a1ca4f6b5007090cab2692c5b"
|
|
||||||
integrity sha512-udk6Yv34XSzBl5P36H0fFCeL00/BbtjA9KpxvoXyGsxq5zCLkiS0x7FR+qde2AQJ+TNwEY/GZQVXs0hT66+Zng==
|
|
||||||
dependencies:
|
|
||||||
fflate "^0.4.1"
|
|
||||||
|
|
||||||
potrace@^2.1.8:
|
potrace@^2.1.8:
|
||||||
version "2.1.8"
|
version "2.1.8"
|
||||||
resolved "https://registry.yarnpkg.com/potrace/-/potrace-2.1.8.tgz#50f6fba92e1e39ddef6f979b0a0f841809e0acf2"
|
resolved "https://registry.yarnpkg.com/potrace/-/potrace-2.1.8.tgz#50f6fba92e1e39ddef6f979b0a0f841809e0acf2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user