mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
configuration of google analytics tracking ID through the settings interface
This commit is contained in:
parent
4841027216
commit
419605e551
@ -1,6 +1,7 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- Improved display of the icons alerting about an outdated version
|
||||
- [TODO DEPLOY] `rails fablab:setup:env_to_db`
|
||||
|
||||
## v4.4.4 2020 May 25
|
||||
|
||||
|
@ -77,6 +77,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
|
||||
$scope.fablabName = { name: 'fablab_name', value: settingsPromise.fablab_name };
|
||||
$scope.nameGenre = { name: 'name_genre', value: settingsPromise.name_genre };
|
||||
$scope.machinesSortBy = { name: 'machines_sort_by', value: settingsPromise.machines_sort_by };
|
||||
$scope.trackingId = { name: 'tracking_id', value: settingsPromise.tracking_id }
|
||||
$scope.cguFile = cguFile.custom_asset;
|
||||
$scope.cgvFile = cgvFile.custom_asset;
|
||||
$scope.customLogo = logoFile.custom_asset;
|
||||
|
@ -1009,7 +1009,7 @@ angular.module('application.router', ['ui.router'])
|
||||
resolve: {
|
||||
settingsPromise: ['Setting', function (Setting) {
|
||||
return Setting.query({
|
||||
names: `['twitter_name', 'about_title', 'about_body', \
|
||||
names: `['twitter_name', 'about_title', 'about_body', 'tracking_id',\
|
||||
'privacy_body', 'privacy_dpo', 'about_contacts', \
|
||||
'home_blogpost', 'machine_explications_alert', 'training_explications_alert', \
|
||||
'training_information_message', 'subscription_explications_alert', 'event_explications_alert', \
|
||||
|
@ -81,18 +81,18 @@
|
||||
<button name="button" class="btn btn-warning m-l" ng-click="save(phoneRequired)" translate>{{ 'app.shared.buttons.save' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="alert alert-warning m-t" ng-bind-html="'app.admin.settings.privacy.google_analytics_info_html' | translate"></p>
|
||||
<p class="alert alert-warning m-t" ng-bind-html="'app.admin.settings.privacy.tracking_id_info_html' | translate"></p>
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-md-offset-1">
|
||||
<label for="google_analytics" translate>{{ 'app.admin.settings.privacy.google_analytics' }}</label>
|
||||
<input ng-model="googleAnalytics.value"
|
||||
id="google_analytics"
|
||||
<label for="tracking_id" translate>{{ 'app.admin.settings.privacy.tracking_id' }}</label>
|
||||
<input ng-model="trackingId.value"
|
||||
id="tracking_id"
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="UA-000000-2"
|
||||
/>
|
||||
|
||||
<button name="button" class="btn btn-warning m-t" ng-click="save(googleAnalytics)" translate>{{ 'app.shared.buttons.save' }}</button>
|
||||
<button name="button" class="btn btn-warning m-t" ng-click="save(trackingId)" translate>{{ 'app.shared.buttons.save' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -76,7 +76,8 @@ class Setting < ApplicationRecord
|
||||
home_css
|
||||
origin
|
||||
uuid
|
||||
phone_required] }
|
||||
phone_required
|
||||
tracking_id] }
|
||||
def value
|
||||
last_value = history_values.order(HistoryValue.arel_table['created_at'].desc).first
|
||||
last_value&.value
|
||||
|
@ -35,7 +35,7 @@
|
||||
Fablab.featureTourDisplay = "<%= Rails.application.secrets.feature_tour_display %>";
|
||||
Fablab.disqusShortname = "<%= Rails.application.secrets.disqus_shortname %>";
|
||||
Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>";
|
||||
Fablab.gaId = "<%= Rails.application.secrets.google_analytics_id %>";
|
||||
Fablab.gaId = "<%= Setting.get('tracking_id') %>";
|
||||
Fablab.superadminId = parseInt("<%= User.superadmin&.id %>", 10);
|
||||
|
||||
// i18n stuff
|
||||
|
@ -1020,6 +1020,7 @@ en:
|
||||
machines_sort_by: "machines display order"
|
||||
fab_analytics: "Fab Analytics"
|
||||
phone_required: "phone required"
|
||||
tracking_id: "tracking ID"
|
||||
elements_ordering: "Elements ordering"
|
||||
machines_order: "Machines order"
|
||||
display_machines_sorted_by: "Display machines sorted by"
|
||||
@ -1061,8 +1062,8 @@ en:
|
||||
various_settings: "Various settings"
|
||||
phone_required: "Phone required"
|
||||
phone_required_info: "You can define if the phone number should be required to register a new user on Fab-manager."
|
||||
google_analytics_info_html: "To enable the statistical tracking of the visits using Google Analytics, set your tracking ID here. It is in the form UA-000000-2. Visit <a href='https://analytics.google.com/analytics/web/' target='_blank'>the Google Analytics website</a> to get one.<strong>Warning :</strong> if you enable this feature, remember to write it in your privacy policy, above."
|
||||
google_analytics: "Tracking ID"
|
||||
tracking_id_info_html: "To enable the statistical tracking of the visits using Google Analytics, set your tracking ID here. It is in the form UA-000000-2. Visit <a href='https://analytics.google.com/analytics/web/' target='_blank'>the Google Analytics website</a> to get one.<strong>Warning :</strong> if you enable this feature, remember to write it in your privacy policy, above."
|
||||
tracking_id: "Tracking ID"
|
||||
open_api_clients:
|
||||
add_new_client: "Create new API client"
|
||||
api_documentation: "API documentation"
|
||||
|
@ -1020,6 +1020,7 @@ fr:
|
||||
machines_sort_by: "l'ordre d'affichage des machines"
|
||||
fab_analytics: "Fab Analytics"
|
||||
phone_required: "téléphone requis"
|
||||
tracking_id: "ID de suivi"
|
||||
elements_ordering: "Ordre d'affichage des éléments"
|
||||
machines_order: "Ordre des machines"
|
||||
display_machines_sorted_by: "Afficher les machines triées par"
|
||||
@ -1061,8 +1062,8 @@ fr:
|
||||
various_settings: "Paramètres divers"
|
||||
phone_required: "Téléphone requis"
|
||||
phone_required_info: "Vous pouvez définir si le numéro de téléphone doit être requis, lors de l'enregistrement d'un nouvel utilisateur sur Fab-manager."
|
||||
google_analytics_info_html: "Pour activer les suivi statistique des visites utilisant Google Analytics, définissez ici votre ID de suivi. Il se présente sous la forme UA-000000-2. Visitez <a href='https://analytics.google.com/analytics/web/' target='_blank'>le site web de Google Analytics</a> pour en obtenir un.<br/><strong>Attention :</strong> si vous activez cette fonctionnalité, pensez à l'indiquer dans votre politique de confidentialité, ci-dessus."
|
||||
google_analytics: "ID de suivi"
|
||||
tracking_id_info_html: "Pour activer les suivi statistique des visites utilisant Google Analytics, définissez ici votre ID de suivi. Il se présente sous la forme UA-000000-2. Visitez <a href='https://analytics.google.com/analytics/web/' target='_blank'>le site web de Google Analytics</a> pour en obtenir un.<br/><strong>Attention :</strong> si vous activez cette fonctionnalité, pensez à l'indiquer dans votre politique de confidentialité, ci-dessus."
|
||||
tracking_id: "ID de suivi"
|
||||
open_api_clients:
|
||||
add_new_client: "Créer un compte client"
|
||||
api_documentation: "Documentation de l'API"
|
||||
|
@ -146,7 +146,6 @@ staging:
|
||||
openlab_app_id: <%= ENV["OPENLAB_APP_ID"] %>
|
||||
openlab_default: <%= ENV["OPENLAB_DEFAULT"] %>
|
||||
openlab_base_uri: <%= ENV["OPENLAB_BASE_URI"] %>
|
||||
google_analytics_id: <%= ENV["GA_ID"] %>
|
||||
navinum_api_login: <%= ENV["NAVINUM_API_LOGIN"] %>
|
||||
navinum_api_password: <%= ENV["NAVINUM_API_PASSWORD"] %>
|
||||
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
|
||||
@ -205,7 +204,6 @@ production:
|
||||
openlab_app_id: <%= ENV["OPENLAB_APP_ID"] %>
|
||||
openlab_default: <%= ENV["OPENLAB_DEFAULT"] %>
|
||||
openlab_base_uri: <%= ENV["OPENLAB_BASE_URI"] %>
|
||||
google_analytics_id: <%= ENV["GA_ID"] %>
|
||||
navinum_api_login: <%= ENV["NAVINUM_API_LOGIN"] %>
|
||||
navinum_api_password: <%= ENV["NAVINUM_API_PASSWORD"] %>
|
||||
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
|
||||
|
@ -925,12 +925,6 @@ unless Setting.find_by(name: 'link_name').try(:value)
|
||||
setting.save
|
||||
end
|
||||
|
||||
unless Setting.find_by(name: 'phone_required').try(:value)
|
||||
setting = Setting.find_or_initialize_by(name: 'phone_required')
|
||||
setting.value = ENV.fetch('PHONE_REQUIRED', 'true')
|
||||
setting.save
|
||||
end
|
||||
|
||||
unless Setting.find_by(name: 'home_content').try(:value)
|
||||
setting = Setting.find_or_initialize_by(name: 'home_content')
|
||||
setting.value = <<~HTML
|
||||
|
@ -155,11 +155,6 @@ See http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-config
|
||||
When DELIVERY_METHOD is set to **smtp**, configure the SMTP server parameters.
|
||||
See https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration for more details.
|
||||
DEFAULT_HOST is also used to configure Google Analytics.
|
||||
<a name="GA_ID"></a>
|
||||
|
||||
GA_ID
|
||||
|
||||
Identifier of your Google Analytics account.
|
||||
<a name="RECAPTCHA_SITE_KEY"></a><a name="RECAPTCHA_SECRET_KEY"></a>
|
||||
|
||||
RECAPTCHA_SITE_KEY, RECAPTCHA_SECRET_KEY
|
||||
|
@ -47,9 +47,6 @@ SMTP_ENABLE_STARTTLS_AUTO=true
|
||||
SMTP_OPENSSL_VERIFY_MODE=
|
||||
SMTP_TLS=false
|
||||
|
||||
# Google analytics
|
||||
GA_ID=
|
||||
|
||||
# Google recaptcha
|
||||
RECAPTCHA_SITE_KEY=
|
||||
RECAPTCHA_SECRET_KEY=
|
||||
|
@ -100,5 +100,19 @@ namespace :fablab do
|
||||
FileUtils.rm_rf 'invoices'
|
||||
FileUtils.mv 'tmp/invoices', 'invoices'
|
||||
end
|
||||
|
||||
desc 'migrate environment variables to the database (settings)'
|
||||
task env_to_db: :environment do
|
||||
mapping = [
|
||||
%w[PHONE_REQUIRED phone_required true],
|
||||
%w[GA_ID tracking_id]
|
||||
]
|
||||
|
||||
mapping.each do |m|
|
||||
setting = Setting.find_or_initialize_by(name: m[1])
|
||||
setting.value = ENV.fetch(m[0], m[2])
|
||||
setting.save if setting.value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -35,8 +35,6 @@ SMTP_ENABLE_STARTTLS_AUTO=true
|
||||
SMTP_OPENSSL_VERIFY_MODE=
|
||||
SMTP_TLS=false
|
||||
|
||||
GA_ID=
|
||||
|
||||
RECAPTCHA_SITE_KEY=
|
||||
RECAPTCHA_SECRET_KEY=
|
||||
|
||||
|
@ -236,7 +236,7 @@ configure_env_file()
|
||||
doc=$(\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/doc/environment.md)
|
||||
variables=(STRIPE_API_KEY STRIPE_PUBLISHABLE_KEY STRIPE_CURRENCY INVOICE_PREFIX FABLAB_WITHOUT_PLANS FABLAB_WITHOUT_SPACES FABLAB_WITHOUT_ONLINE_PAYMENT FABLAB_WITHOUT_INVOICES FABLAB_WITHOUT_WALLET \
|
||||
PHONE_REQUIRED BOOK_SLOT_AT_SAME_TIME USER_CONFIRMATION_NEEDED_TO_SIGN_IN EVENTS_IN_CALENDAR SLOT_DURATION DEFAULT_MAIL_FROM DELIVERY_METHOD DEFAULT_HOST DEFAULT_PROTOCOL SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
|
||||
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS GA_ID RECAPTCHA_SITE_KEY RECAPTCHA_SECRET_KEY DISQUS_SHORTNAME TWITTER_NAME \
|
||||
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS RECAPTCHA_SITE_KEY RECAPTCHA_SECRET_KEY DISQUS_SHORTNAME TWITTER_NAME \
|
||||
FACEBOOK_APP_ID LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT FEATURE_TOUR_DISPLAY \
|
||||
SUPERADMIN_EMAIL APP_LOCALE RAILS_LOCALE MOMENT_LOCALE SUMMERNOTE_LOCALE ANGULAR_LOCALE FULLCALENDAR_LOCALE ELASTICSEARCH_LANGUAGE_ANALYZER TIME_ZONE \
|
||||
WEEK_STARTING_DAY D3_DATE_FORMAT UIB_DATE_FORMAT EXCEL_DATE_FORMAT OPENLAB_APP_ID OPENLAB_APP_SECRET OPENLAB_DEFAULT)
|
||||
|
Loading…
x
Reference in New Issue
Block a user