2023-12-04 12:30:20 +03:00
|
|
|
<%= on_full_build do %>
|
|
|
|
<%= if !@conn.assigns[:skip_plausible_tracking] do %>
|
|
|
|
<script
|
|
|
|
defer
|
|
|
|
data-api={PlausibleWeb.Dogfood.api_destination()}
|
|
|
|
data-domain={PlausibleWeb.Dogfood.domain(@conn)}
|
|
|
|
src={PlausibleWeb.Dogfood.script_url()}
|
|
|
|
>
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }
|
2023-09-21 13:05:50 +03:00
|
|
|
|
2023-12-04 12:30:20 +03:00
|
|
|
<%= if @conn.assigns[:dogfood_page_path] do %>
|
|
|
|
const pageUrl = '<%= Path.join(plausible_url(), @conn.assigns[:dogfood_page_path]) %>'
|
|
|
|
<% else %>
|
|
|
|
const pageUrl = window.location.href
|
|
|
|
<% end %>
|
2023-09-21 13:05:50 +03:00
|
|
|
|
2023-12-04 12:30:20 +03:00
|
|
|
plausible('pageview', {
|
|
|
|
u: pageUrl,
|
|
|
|
props: {
|
2024-02-12 12:11:19 +03:00
|
|
|
logged_in: <%= is_map(@conn.assigns[:current_user]) %>,
|
|
|
|
theme: '<%= if @conn.assigns[:current_user], do: @conn.assigns[:current_user].theme, else: "system" %>',
|
|
|
|
browser_language: navigator.language || navigator.userLanguage
|
2023-12-04 12:30:20 +03:00
|
|
|
}
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
<% end %>
|
2023-09-21 13:05:50 +03:00
|
|
|
<% end %>
|