Skip to content

Commit

Permalink
Update TNA Frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Mar 25, 2024
1 parent ec26858 commit ac0e9ca
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 270 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint:fix": "prettier --write src && stylelint --fix 'src/styles/**/*.scss' && eslint --fix 'src/scripts/**/*.js'"
},
"dependencies": {
"@nationalarchives/frontend": "0.1.47"
"@nationalarchives/frontend": "0.1.48"
},
"devDependencies": {
"@babel/core": "^7.22.11",
Expand Down
14 changes: 4 additions & 10 deletions src/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,16 @@ import {
GA4,
helpers,
} from "@nationalarchives/frontend/nationalarchives/analytics.mjs";
// import {
// GA4,
// helpers,
// } from "./tmp/analytics.mjs";
// import { GA4, helpers } from "./tmp/analytics.mjs";
import "./modules/theme-switcher";

initAll();

// const GA4 = window.TNAFrontendAnalytics.GA4;
// const helpers = window.TNAFrontendAnalytics.helpers;

const ga4Id = document.documentElement.getAttribute("data-ga4id");
if (ga4Id) {
const analytics = new GA4({ id: ga4Id });

analytics.addListener(".etna-article__sidebar", "sidebar", [
analytics.addListeners(".etna-article__sidebar", "sidebar", [
{
eventName: "section.jump_to",
targetElement: ".etna-article__sidebar-item",
Expand All @@ -29,7 +23,7 @@ if (ga4Id) {
},
]);

analytics.addListener(".etna-article", "article", [
analytics.addListeners(".etna-article", "article", [
{
eventName: "section.toggle",
targetElement: ".etna-article__section-button",
Expand All @@ -41,7 +35,7 @@ if (ga4Id) {
},
]);

analytics.addListener(document.documentElement, "document", [
analytics.addListeners(document.documentElement, "document", [
{
eventName: "double_click",
on: "dblclick",
Expand Down
Loading

0 comments on commit ac0e9ca

Please sign in to comment.