Skip to content

Commit

Permalink
add dap analytics and route page send to about, acknowledgements, glo…
Browse files Browse the repository at this point in the history
…ssary, overview
  • Loading branch information
toro-bah committed Oct 18, 2024
1 parent 0db6689 commit f47c807
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
defer
src="https://www.section508.gov/assets/js/uswds.min.js"
></script>
<script async type="text/javascript"
src="https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency=GSA&sitetopic=acr-editor&dapdev=true"
id="_fed_an_ua_tag"></script>
<style>
/* GSA/Section508 placeholder styling.
* Dark blue: #162E51
Expand Down
5 changes: 4 additions & 1 deletion src/routes/About.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import { reportFilename } from "../utils/reportFilename.js";
import { getCatalog, getListOfCatalogs } from "../utils/getCatalogs.js";
import { updateEvaluation } from "../utils/updateEvaluation.js";
import { gasPageSend } from '../utils/dap.js';
const location = useLocation();
let catalog = getCatalog($evaluation.catalog);
let catalogChoices = getListOfCatalogs();
Expand All @@ -28,6 +29,8 @@
onMount(() => {
currentPage.update(currentPage => "About");
gasPageSend(location.pathname, document.title);
honourFragmentIdLinks($location);
});
Expand Down
5 changes: 4 additions & 1 deletion src/routes/Acknowledgements.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
import HeaderWithAnchor from "../components/HeaderWithAnchor.svelte";
import { currentPage } from "../stores/currentPage.js";
import { honourFragmentIdLinks } from "../utils/honourFragmentIdLinks.js";
import { gasPageSend } from '../utils/dap.js';
const location = useLocation();
onMount(() => {
currentPage.update(currentPage => "Acknowledgements");
gasPageSend(location.pathname, document.title);
honourFragmentIdLinks($location);
});
</script>
Expand Down
7 changes: 5 additions & 2 deletions src/routes/Glossary.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
import DTWithAnchor from "../components/DTWithAnchor.svelte";
import { currentPage } from "../stores/currentPage.js";
import { honourFragmentIdLinks } from "../utils/honourFragmentIdLinks.js";
import { gasPageSend } from '../utils/dap.js';
const location = useLocation();
onMount(() => {
currentPage.update(currentPage => "Glossary");
gasPageSend(location.pathname, document.title);
honourFragmentIdLinks($location);
});
</script>
Expand Down
5 changes: 4 additions & 1 deletion src/routes/Overview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
import { honourFragmentIdLinks } from "../utils/honourFragmentIdLinks.js";
import { evaluation } from "../stores/evaluation.js";
import { getCatalog } from "../utils/getCatalogs.js";
import { gasPageSend } from '../utils/dap.js';
const location = useLocation();
let catalog = getCatalog($evaluation.catalog);
onMount(() => {
currentPage.update((currentPage) => "Overview");
gasPageSend(location.pathname, document.title);
honourFragmentIdLinks($location);
});
</script>
Expand Down
5 changes: 5 additions & 0 deletions src/utils/dap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const gasPageSend = (path, title) => {
if (typeof gas !== "undefined") {
gas("send", "pageview", path, title);
}
}

0 comments on commit f47c807

Please sign in to comment.