analytics/lib/plausible_web/templates/layout/_tracking.html.heex
Uku Taht aee6f105c2
Fix dogfooding (#3377)
* Track funnels and custom props settings

* Send dogfood script events to ingest.plausible.io

* Mix format
2023-09-28 11:08:58 +02:00

26 lines
758 B
Plaintext

<%= if !Application.get_env(:plausible, :is_selfhost) && !@conn.assigns[:skip_plausible_tracking] do %>
<script
defer
data-api={dogfood_api_destination()}
data-domain={dogfood_domain(@conn)}
src={dogfood_script_url()}
>
</script>
<script>
window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }
<%= 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 %>
plausible('pageview', {
u: pageUrl,
props: {
logged_in: <%= !!@conn.assigns[:current_user] %>
}
})
</script>
<% end %>