Skip to content

Commit

Permalink
Update Analytics Script (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
coliff committed Feb 6, 2024
1 parent 805b882 commit 2f8fb09
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 31 deletions.
4 changes: 4 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"getenv",
"horiz",
"iframe",
"incab",
"jquery",
"labelledby",
"liga",
Expand All @@ -33,6 +34,7 @@
"noopener",
"noscript",
"npmjs",
"onclick",
"paren",
"pe-none",
"picocolors",
Expand Down Expand Up @@ -60,6 +62,7 @@
"trimbleinc",
"twbs",
"uncombine",
"uncompiled",
"undock",
"urlize",
"versioner",
Expand All @@ -73,6 +76,7 @@
".cspell.json",
"**/node_modules/**",
"*.min.*",
"*.js",
".github/CODEOWNERS",
"{coverage,.cache,.git,.vscode,.DS_Store,tests}/**/*",
"app-components/preview/app-components.js"
Expand Down
10 changes: 9 additions & 1 deletion .ncurc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"reject": ["file-type", "mkdirp", "read-chunk", "svgicons2svgfont", "ttf2eot", "ttf2woff", "url-join"]
"reject": [
"file-type",
"mkdirp",
"read-chunk",
"svgicons2svgfont",
"ttf2eot",
"ttf2woff",
"url-join"
]
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
16.20.2
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ _modus-bootstrap-dark.scss
hugo.yml
package.json
package-lock.json

2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

To get started, clone the repo, install dependencies, and run the build script.

You must use Node v16 to build the project.

```shell
git clone https://github.com/trimble-oss/modus-icons/
cd modus-icons
Expand Down
2 changes: 1 addition & 1 deletion app-components/preview/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Site Search</title>
Expand Down
2 changes: 1 addition & 1 deletion app-components/src/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en">
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>SiteSearch</title>
Expand Down
2 changes: 1 addition & 1 deletion docs/layouts/_default/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{{ $external := resources.Get "js/app-components.js" }}
{{ $appComponentsJs := slice $external | resources.Concat "js/app-components.js" | resources.Minify | resources.Fingerprint }}
<script src="{{- $appComponentsJs.RelPermalink -}}" defer fetchpriority="high"></script>
<script>document.addEventListener('DOMContentLoaded', function () { plausible('404', { props: { path: document.location.pathname } }); });</script>

{{- .Content -}}

Expand All @@ -28,5 +29,4 @@ <h2 class="display-1 text-center mx-auto pt-5">
Looking for an icon? Use the search above!
</p>

<script>plausible("404", { props: { path: document.location.pathname } });</script>
{{ end }}
4 changes: 2 additions & 2 deletions docs/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<!doctype html>
<html lang="en">
<html lang="en-US">

<head>
{{- partial "head" . }}
{{ partial "analytics" . }}
</head>

<body class="{{ if .IsPage }}single{{ else }}list{{ end }}">
Expand All @@ -16,7 +17,6 @@

{{ partialCached "footer" . }}
{{ partialCached "scripts" . }}
{{ partial "analytics" . }}
</body>

</html>
3 changes: 2 additions & 1 deletion docs/layouts/_default/font.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!doctype html>
<html lang="en">
<html lang="en-US">
<head>
{{ partial "head" . }}
{{ partial "analytics" . }}
</head>
<body class="text-center">
{{ partialCached "skippy" . }}
Expand Down
4 changes: 2 additions & 2 deletions docs/layouts/_default/home.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!doctype html>
<html lang="en">
<html lang="en-US">
<head>
{{ partial "head" . }}
{{ partial "analytics" . }}
</head>

<body class="home">
Expand Down Expand Up @@ -96,6 +97,5 @@ <h2 class="fw-bold">Modus Icons by Sector</h2>

{{- partialCached "footer" . }}
{{- partialCached "scripts" . }}
{{ partial "analytics" . }}
</body>
</html>
4 changes: 2 additions & 2 deletions docs/layouts/modus-outlined/home.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<!doctype html>
<html lang="en">
<html lang="en-US">

<head>
{{ partial "head" . }}
{{ partial "analytics" . }}
</head>

<body>
Expand All @@ -18,7 +19,6 @@

{{- partialCached "footer" . }}
{{- partialCached "scripts" . }}
{{ partial "analytics" . }}

</body>

Expand Down
4 changes: 2 additions & 2 deletions docs/layouts/modus-solid/home.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<!doctype html>
<html lang="en">
<html lang="en-US">

<head>
{{ partial "head" . }}
{{ partial "analytics" . }}
</head>

<body>
Expand All @@ -18,7 +19,6 @@

{{- partialCached "footer" . }}
{{- partialCached "scripts" . }}
{{ partial "analytics" . }}
</body>

</html>
31 changes: 20 additions & 11 deletions docs/layouts/partials/analytics.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
{{- if not .Site.IsServer -}}
<script id="plausible" defer data-domain="modus-icons.trimble.com"
src="https://plausible.io/js/script.outbound-links.js" fetchpriority="low"></script>
<script>
if (window.location.host === 'modus-icons.trimble.com') {
var script = document.createElement('script');
script.defer = true;
script.setAttribute('data-domain', 'modus-icons.trimble.com');
script.src = 'https://plausible.io/js/script.outbound-links.file-downloads.js';
document.head.appendChild(script);
}
</script>
<script>window.plausible = window.plausible || function () { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>

<script src="/js/trimble-insights.min.js"></script>
<script src="/js/trimble-insights.min.js" async></script>
<script>
window.tdcafLogger.init({
appname: 'trimble-tux-modusicons-web-dev',
headers: {
'x-app-name': 'trimble-tux-modusicons-web-dev',
'x-api-key': '{{- .Site.Params.trimble_insights_key -}}'
},
interval: 2000
document.addEventListener("DOMContentLoaded", function() {
window.tdcafLogger.init({
appname: 'trimble-tux-modusicons-web-dev',
headers: {
'x-app-name': 'trimble-tux-modusicons-web-dev',
'x-api-key': '{{- .Site.Params.trimble_insights_key -}}'
},
interval: 2000
});
window.tdcafLogger.trackEvents();
});
window.tdcafLogger.trackEvents();
</script>
{{ end }}
3 changes: 2 additions & 1 deletion docs/layouts/transportation/home.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<!doctype html>
<html lang="en">
<html lang="en-US">

<head>
{{ partial "head" . }}
{{ partial "analytics" . }}
</head>

<body id="icons-body">
Expand Down
2 changes: 1 addition & 1 deletion hugo.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
languageCode: "en"
languageCode: "en-US"
title: "Modus Icons"
baseURL: "https://modus-icons.trimble.com/"
enableInlineShortcodes: true
Expand Down
2 changes: 1 addition & 1 deletion icons/modus-outlined/drivers.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/modus-outlined/less-than-equal-to.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/modus-solid/less-than-equal-to.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2f8fb09

Please sign in to comment.