Commit deb3e2e4 authored by Alex Buijs's avatar Alex Buijs

Trigger tracking event without user interaction

parent 8b8c5984
......@@ -20,12 +20,14 @@ document.addEventListener('DOMContentLoaded', () => {
// Save the URL fragment from the current window location. This will be present if the user was
// redirected to sign-in after attempting to access a protected URL that included a fragment.
preserveUrlFragment(window.location.hash);
});
if (gon.tracking_data) {
const { category, action, ...data } = gon.tracking_data;
if (gon.tracking_data) {
const tab = document.querySelector(".new-session-tabs a[href='#register-pane']");
const { category, action, ...data } = gon.tracking_data;
tab.addEventListener('click', () => {
$('#signin-container a[data-toggle="tab"]').on('shown.bs.tab', e => {
if (e.target.dataset.qaSelector === 'register_tab') {
Tracking.event(category, action, data);
});
}
});
}
});
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment