docbrown/app/javascript/admin/controllers/ahoy_controller.js
rhymes e5226b9951
Upgrade Stimulus to 3.0 (#14869)
* Upgrade Stimulus to 3.0

* Remove unused variable

* Bump postcss from 8.3.8 to 8.3.9 (#14956)

Bumps [postcss](https://github.com/postcss/postcss) from 8.3.8 to 8.3.9.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.3.8...8.3.9)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-05 20:00:37 +02:00

19 lines
462 B
JavaScript

import { Controller } from '@hotwired/stimulus';
import ahoy from 'ahoy.js';
ahoy.configure({
cookies: false,
trackVisits: false,
});
export default class AhoyController extends Controller {
trackOverviewLink(event) {
event.preventDefault();
const properties = {
action: event.type,
target: event.target.toString(),
};
ahoy.track('Admin Overview Link Clicked', properties);
window.location.href = event.target.href;
}
}