Skip to content

Commit

Permalink
Merge pull request #623 from semaphore-protocol/chore/cookies
Browse files Browse the repository at this point in the history
Matomo script for cookies
  • Loading branch information
cedoor authored Feb 8, 2024
2 parents ca72abb + 3a1f078 commit 2d59691
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
25 changes: 25 additions & 0 deletions apps/docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,31 @@ const config: Config = {
defaultLocale: "en",
locales: ["en", "es"]
},
headTags: [
{
tagName: "link",
attributes: {
rel: "preconnect",
href: "https://psedev.matomo.cloud"
}
},
{
tagName: "script",
innerHTML: `
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://psedev.matomo.cloud/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '10']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src='//cdn.matomo.cloud/psedev.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s);
})();
`
}
],
presets: [
[
"classic",
Expand Down
17 changes: 17 additions & 0 deletions apps/website/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box, Container } from "@chakra-ui/react"
import type { Metadata } from "next"
import Script from "next/script"
import Footer from "../components/Footer"
import Navbar from "../components/Navbar"
import Providers from "./providers"
Expand Down Expand Up @@ -37,6 +38,22 @@ export default function RootLayout({ children }: { children: React.ReactNode })
</Container>
</Providers>
</body>

<Script id="matomo-tracking" strategy="afterInteractive">
{`
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://psedev.matomo.cloud/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '10']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src='//cdn.matomo.cloud/psedev.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s);
})();
`}
</Script>
</html>
)
}

0 comments on commit 2d59691

Please sign in to comment.