mirror of
https://github.com/plausible/analytics.git
synced 2024-11-09 16:46:40 +03:00
Rename dimensions script to pageview-props (#2786)
* rename dimensions script to pageview-props * commit mix.lock change
This commit is contained in:
parent
5fe32b59cd
commit
bc835895a2
@ -10,7 +10,7 @@ defmodule PlausibleWeb.Tracker do
|
||||
"local",
|
||||
"manual",
|
||||
"file-downloads",
|
||||
"dimensions",
|
||||
"pageview-props",
|
||||
"tagged-events"
|
||||
]
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
<%= if !Application.get_env(:plausible, :is_selfhost) && !@conn.assigns[:skip_plausible_tracking] do %>
|
||||
<%= if Application.get_env(:plausible, :environment) in ["prod", "staging"] do %>
|
||||
<script defer data-domain="<%= base_domain() %>" event-logged_in="<%= !!@conn.assigns[:current_user] %>" src="<%="#{plausible_url()}/js/script.dimensions.js"%>"></script>
|
||||
<script defer data-domain="<%= base_domain() %>" event-logged_in="<%= !!@conn.assigns[:current_user] %>" src="<%="#{plausible_url()}/js/script.pageview-props.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 data-domain="<%= base_domain() %>" event-logged_in="<%= !!@conn.assigns[:current_user] %>" src="<%="#{plausible_url()}/js/plausible.local.dimensions.js"%>"></script>
|
||||
<script defer data-domain="<%= base_domain() %>" event-logged_in="<%= !!@conn.assigns[:current_user] %>" src="<%="#{plausible_url()}/js/plausible.local.pageview-props.js"%>"></script>
|
||||
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -26,7 +26,7 @@ function compilefile(input, output, templateVars = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
const base_variants = ["hash", "outbound-links", "exclusions", "compat", "local", "manual", "file-downloads", "dimensions", "tagged-events"]
|
||||
const base_variants = ["hash", "outbound-links", "exclusions", "compat", "local", "manual", "file-downloads", "pageview-props", "tagged-events"]
|
||||
const variants = [...g.clone.powerSet(base_variants)].filter(a => a.length > 0).map(a => a.sort());
|
||||
|
||||
compilefile(relPath('src/plausible.js'), relPath('../priv/tracker/js/plausible.js'))
|
||||
|
@ -77,14 +77,14 @@
|
||||
payload.p = options.props
|
||||
}
|
||||
|
||||
{{#if dimensions}}
|
||||
var dimensionAttributes = scriptEl.getAttributeNames().filter(function (name) {
|
||||
{{#if pageview_props}}
|
||||
var propAttributes = scriptEl.getAttributeNames().filter(function (name) {
|
||||
return name.substring(0, 6) === 'event-'
|
||||
})
|
||||
|
||||
var props = payload.p || {}
|
||||
|
||||
dimensionAttributes.forEach(function(attribute) {
|
||||
propAttributes.forEach(function(attribute) {
|
||||
var propKey = attribute.replace('event-', '')
|
||||
var propValue = scriptEl.getAttribute(attribute)
|
||||
props[propKey] = props[propKey] || propValue
|
||||
|
Loading…
Reference in New Issue
Block a user