Knowing that Discourse is a SPA and having looked at some docs around this topic I am still not sure how to achieve this:
- we include a custom js library in the footer that interfaces with our statistics solution
- we want to enrich the stats by triggering custom events on every “page load”, e.g whenever the user navigates to a “new” page
Pseudo code:
window.statistic = window.statistic || [];
window.statistic.push({
action: "page.ready",
data: {
page: {
path: "/c/new-to-this-forum-get-started-here/20/l/new",
country: "WW",
language: "en",
}, user: {
country: "DE",
loginStatus: "logged_in"
}
} });
How and where in my custom theme do I need to place the code to achieve this?
Thanks