Skip to content

Commit

Permalink
allow different analytics urls
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed May 29, 2023
1 parent f0019e9 commit 9076d66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/views/admin/iframe/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<iframe plausible-embed src="<%= ENV.fetch("ADMIN_IFRAME_URL") %>" scrolling="no" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;"></iframe>
<iframe plausible-embed src="<%= ENV.fetch("#{current_organization.host.split(".").first.upcase}_ANALYTICS_URL") %>" scrolling="no" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;"></iframe>
<div style="font-size: 14px; padding-bottom: 14px;">Stats powered by <a target="_blank" style="color: #4F46E5; text-decoration: underline;" href="https://plausible.io">Plausible Analytics</a></div>
<script async src="https://analytics.decidim.somenergia.coop/js/embed.host.js"></script>
15 changes: 7 additions & 8 deletions config/initializers/decidim_overrides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
end
end

if ENV.fetch("ADMIN_IFRAME_URL", nil).present?
Decidim.menu :admin_menu do |menu|
menu.add_item :custom_iframe,
"Estadísques web",
Rails.application.routes.url_helpers.admin_iframe_index_path,
icon_name: "pie-chart",
position: 10
end
Decidim.menu :admin_menu do |menu|
menu.add_item :custom_iframe,
"Estadísques web",
Rails.application.routes.url_helpers.admin_iframe_index_path,
icon_name: "pie-chart",
position: 10,
if: ENV.fetch("#{current_organization.host.split(".").first.upcase}_ANALYTICS_URL", nil).present?
end

Decidim.menu :admin_user_menu do |menu|
Expand Down

0 comments on commit 9076d66

Please sign in to comment.