const formsToTrack = [
{ "submit_id": "settings_submit_displayname", "form_id": "settings_form_displayname", "event": "settings-update-displayname" },
{ "submit_id": "linkedit_submit_delete", "form_id": "linkedit_form_delete", "event": "linkedit-delete" },
{ "submit_id": "linkedit_submit_visual", "form_id": "linkedit_form_visual", "event": "linkedit-update-visual" },
{ "submit_id": "linkedit_submit_link", "form_id": "linkedit_form_link", "event": "linkedit-update-link" },
{ "submit_id": "tags_submit_delete", "form_id": "tags_form_delete", "event": "tags-delete" },
{ "submit_id": "tags_submit_new", "form_id": "tags_form_new", "event": "tags-new" },
{ "submit_id": "index_submit_link_new", "form_id": "index_form_link_new", "event": "index-link-new" },
];
for (var i = 0; i < formsToTrack.length; i++) {
const obj = formsToTrack[i];
const submit = document.getElementById(obj.submit_id);
if (submit == null) {
continue;
}
submit.setAttribute("type", "button");
submit.setAttribute("onclick", `umami.track('${obj.event}').then(function() {document.getElementById('${obj.form_id}').submit()})`)
}