docbrown/app/javascript/admin/controllers/ahoy_controller.js
Jacob Herrington 92217be4ed
Add admin overview page (#12726)
* Add admin overview page

* Rename admin_portals spec

* Fix admin nav bug

* Add ahoy tracking to admin overview

* Fix PR Feedback

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Make decorative element more visible

* Remove inline layout styles

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2021-03-01 18:59:05 -06:00

20 lines
499 B
JavaScript

import { Controller } from 'stimulus';
import ahoy from 'ahoy.js';
ahoy.configure({
cookies: false,
trackVisits: false,
});
// eslint-disable-next-line no-restricted-syntax
export default class AhoyController extends Controller {
trackOverviewLink(event) {
event.preventDefault();
let properties = {
action: event.type,
target: event.target.toString(),
};
ahoy.track('Admin Overview Link Clicked', properties);
window.location.href = event.target.href;
}
}