Skip to content

Commit

Permalink
record accordion opens in Matomo
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Perrien Fenstermacher committed Mar 28, 2024
1 parent 6e7cc5a commit 039a73a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion about/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ menus:
<!-- End: Info box -->

<!-- START: Accordions Each h2 below will be a separate accordion. -->
<div class="accordion default border-top-gradient-software-blue-green border-bottom-gradient-software-blue-green">
<div class="border-top-gradient-software-blue-green border-bottom-gradient-software-blue-green">
{% capture accordionContent %}
If you’re new to GitHub and open source in general, figuring out how to get set up can be a challenge. You may want to read through the GitHub Help pages on [setting up and managing your GitHub profile](https://support.github.com/features/account).

Expand Down
9 changes: 8 additions & 1 deletion assets/js/hashes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ window.addEventListener('load', function() {
if (!element) {
return;
}
console.log(element);
if (element.className.indexOf('accordion-collapse') > -1) {
new bootstrap.Collapse(element, { show: true });
recordAccordionOpen(element);
}
}

Expand All @@ -22,6 +22,7 @@ window.addEventListener('load', function() {
element.addEventListener('show.bs.collapse', function(event) {
const hash = '#' + event.target.id;
window.history.replaceState('', '', hash);
recordAccordionOpen(element);
});

element.addEventListener('hide.bs.collapse', function(event) {
Expand All @@ -33,4 +34,10 @@ window.addEventListener('load', function() {

});
}

function recordAccordionOpen(element) {
if (typeof _paq !== 'undefined') {
_paq.push(['trackEvent', 'Accordion', 'Opened', element.id]);
}
}
});

0 comments on commit 039a73a

Please sign in to comment.