Skip to content

Commit

Permalink
Remove Analytics Events (#2910)
Browse files Browse the repository at this point in the history
  • Loading branch information
fran-tirapu authored Jan 9, 2025
1 parent 647da06 commit 1e51241
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ const authenticateUser = async () => {
window.auth._id = json.user._id
document.querySelector('[data-js-header-auth-user]').classList.add('transition-in')
document.querySelector('[data-js-header-user-avatar]').innerHTML = '<img src="' + auth.avatarUrl + '" alt=""/>'
setAnalyticsEvents()
} else {
window.loggedIn = false
document.querySelector('[data-js-header-auth-visitor]').classList.add('transition-in')
Expand All @@ -166,30 +165,6 @@ const authenticateUser = async () => {
}, 1000)
}

// Set up analytics
const setAnalyticsEvents = async () => {
const sendEvent = async (eventName) => {
try {
await fetch('{{ site.Param "backendURL" }}/analytics', {
mode: 'cors',
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
credentials: 'include',
body: JSON.stringify({
site: window.location.host,
page_url: window.location.pathname,
event_name: eventName,
}),
})
} catch (error) {
console.error(error)
}
}
await sendEvent('page_viewed')
document.addEventListener('copy', async () => await sendEvent('text_copied'))
}

// Log user out
async function userLogout() {
Expand Down

0 comments on commit 1e51241

Please sign in to comment.