Compare commits

...

7 Commits

@ -0,0 +1,18 @@
import * as Sentry from "@sentry/react";
import { Integrations } from "@sentry/tracing";
const container = document.getElementById('stats-react-container')
Sentry.init({
dsn: container.dataset.sentryDsn,
environment: container.dataset.environment,
integrations: [new Integrations.BrowserTracing()],
release: container.dataset.sentryRelease || "unknown",
initialScope: {
tags: {
'app_version': container.dataset.sentryRelease,
'origin': 'dashboard'
},
},
tracesSampleRate: 0.5,
});

File diff suppressed because it is too large Load Diff

@ -19,6 +19,8 @@
"@juggle/resize-observer": "^3.3.1", "@juggle/resize-observer": "^3.3.1",
"@kunukn/react-collapse": "^2.2.9", "@kunukn/react-collapse": "^2.2.9",
"@popperjs/core": "^2.11.6", "@popperjs/core": "^2.11.6",
"@sentry/react": "^7.30.0",
"@sentry/tracing": "^7.30.0",
"@tailwindcss/aspect-ratio": "^0.2.1", "@tailwindcss/aspect-ratio": "^0.2.1",
"@tailwindcss/forms": "^0.3.2", "@tailwindcss/forms": "^0.3.2",
"@tailwindcss/typography": "^0.4.1", "@tailwindcss/typography": "^0.4.1",

@ -14,10 +14,11 @@ module.exports = (env, options) => ({
] ]
}, },
entry: { entry: {
'app': ['./js/app.js'], 'app': ['./js/app.js'],
'dashboard': ['./js/dashboard/mount.js'], 'dashboard': ['./js/dashboard/mount.js'],
'embed.host': ['./js/embed.host.js'], 'dashboard.sentry': ['./js/dashboard/sentry.js'],
'embed.content': ['./js/embed.content.js'] 'embed.host': ['./js/embed.host.js'],
'embed.content': ['./js/embed.content.js']
}, },
output: { output: {
filename: '[name].js', filename: '[name].js',
@ -40,8 +41,8 @@ module.exports = (env, options) => ({
}, },
externals: { moment: 'moment' }, externals: { moment: 'moment' },
plugins: [ plugins: [
new MiniCssExtractPlugin({filename: '../css/[name].css'}), new MiniCssExtractPlugin({ filename: '../css/[name].css' }),
new CopyWebpackPlugin({patterns: [{from: 'static/', to: '../' }]}), new CopyWebpackPlugin({ patterns: [{ from: 'static/', to: '../' }] }),
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
ResizeObserver: ['@juggle/resize-observer', 'ResizeObserver'] // https://caniuse.com/?search=ResizeObserver ResizeObserver: ['@juggle/resize-observer', 'ResizeObserver'] // https://caniuse.com/?search=ResizeObserver
}) })

@ -62,6 +62,9 @@ defmodule PlausibleWeb.StatsController do
|> remove_email_report_banner(site) |> remove_email_report_banner(site)
|> put_resp_header("x-robots-tag", "noindex") |> put_resp_header("x-robots-tag", "noindex")
|> render("stats.html", |> render("stats.html",
sentry_dsn: Application.get_env(:sentry, :dsn),
environment: Application.get_env(:plausible, :environment),
sentry_release: Application.get_env(:sentry, :release),
site: site, site: site,
has_goals: Plausible.Sites.has_goals?(site), has_goals: Plausible.Sites.has_goals?(site),
stats_start_date: stats_start_date, stats_start_date: stats_start_date,
@ -275,6 +278,9 @@ defmodule PlausibleWeb.StatsController do
|> put_resp_header("x-robots-tag", "noindex") |> put_resp_header("x-robots-tag", "noindex")
|> delete_resp_header("x-frame-options") |> delete_resp_header("x-frame-options")
|> render("stats.html", |> render("stats.html",
sentry_dsn: Application.get_env(:sentry, :dsn),
environment: Application.get_env(:plausible, :environment),
sentry_release: Application.get_env(:sentry, :release),
site: shared_link.site, site: shared_link.site,
has_goals: Sites.has_goals?(shared_link.site), has_goals: Sites.has_goals?(shared_link.site),
stats_start_date: shared_link.site.stats_start_date, stats_start_date: shared_link.site.stats_start_date,

@ -15,6 +15,9 @@
<div <div
id="stats-react-container" id="stats-react-container"
style="overflow-anchor: none;" style="overflow-anchor: none;"
data-sentry-dsn="<%= @sentry_dsn %>",
data-sentry-release="<%= @sentry_release %>",
data-environment="<%= @environment %>",
data-domain="<%= @site.domain %>" data-domain="<%= @site.domain %>"
data-offset="<%= Timex.Timezone.total_offset(Timex.Timezone.get(@site.timezone)) %>" data-offset="<%= Timex.Timezone.total_offset(Timex.Timezone.get(@site.timezone)) %>"
data-has-goals="<%= @has_goals %>" data-has-goals="<%= @has_goals %>"
@ -52,5 +55,6 @@
</div> </div>
</div> </div>
<% end %> <% end %>
<script type="text/javascript" src="<%= Routes.static_path(@conn, "/js/dashboard.sentry.js") %>"></script>
<script type="text/javascript" src="<%= Routes.static_path(@conn, "/js/dashboard.js") %>"></script> <script type="text/javascript" src="<%= Routes.static_path(@conn, "/js/dashboard.js") %>"></script>
</div> </div>

Loading…
Cancel
Save