analytics/lib/plausible_web/templates/layout/_tracking.html.eex
2022-02-23 10:21:44 -06:00

18 lines
1.1 KiB
Elixir

<%= if !Application.get_env(:plausible, :is_selfhost) && !@conn.assigns[:skip_plausible_tracking] do %>
<%= if Application.get_env(:plausible, :environment) == "prod" do %>
<script defer src="https://plausible.io/test/js/script.beacon.js" data-api="https://plausible.io/test/api/event"></script>
<script defer src="<%="#{plausible_url()}/js/script.js"%>"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
<% end %>
<%= if Application.get_env(:plausible, :environment) == "staging" do %>
<script defer src="<%="#{plausible_url()}/js/plausible.js"%>"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
<% end %>
<%= if Application.get_env(:plausible, :environment) == "dev" do %>
<script defer src="<%="#{plausible_url()}/js/plausible.local.js"%>"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
<% end %>
<% end %>