[IMP] website: push 404 event to plausible

This Goal will help end user to find most 404 hits and fix the
legits one...
Fixing typo, creating missing redirect, or fixing code.

We need to cast the event-name since plausible only accept 'string'
as custom event name, so if we push 404 instead of '404' the event
crash.

closes odoo/odoo#92243

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Jeremy Kersten
2022-05-27 14:43:00 +02:00
parent 8a01b40d29
commit 7d73a48367
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ publicWidget.registry.o_plausible_push = publicWidget.Widget.extend({
* `data-event-params`
*/
_push() {
const evName = this.$el.data('event-name');
const evName = this.$el.data('event-name').toString();
const evParams = this.$el.data('event-params') || {};
window.plausible(evName, {props: evParams});
},
@@ -2174,6 +2174,12 @@
</t>
</template>
<template id="404_plausible" inherit_id="http_routing.404" name="Plausible 404">
<div id='wrap' position="inside">
<input t-if='website.plausible_shared_key' type='hidden' class='js_plausible_push' data-event-name='404' t-attf-data-event-params='{"path": "#{request.httprequest.path}"}' />
</div>
</template>
<template id="protected_403" name="Page Protected">
<t t-call="website.login_layout">
<div class="container">