diff --git a/Gemfile b/Gemfile index 78ba0b00..a33f1139 100644 --- a/Gemfile +++ b/Gemfile @@ -52,7 +52,6 @@ gem 'file_validators' gem 'fastimage' # Miscellanea -gem 'google-analytics-rails' gem 'staccato' # server side tracking for Google Analytics gem 'tilt', '~> 2.0', '>= 2.0.10' gem 'haml' diff --git a/Gemfile.lock b/Gemfile.lock index fd96470b..20e421a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -201,7 +201,6 @@ GEM glob (0.4.1) globalid (1.1.0) activesupport (>= 5.0) - google-analytics-rails (1.1.1) griddler (1.5.2) htmlentities rails (>= 3.2.0) @@ -521,7 +520,6 @@ DEPENDENCIES file_validators fog-aws gibbon - google-analytics-rails griddler (~> 1.5.2) griddler-mailgun (~> 1.1, >= 1.1.1) groupdate diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb index 2c6cdd7a..16ae163c 100644 --- a/app/controllers/entries_controller.rb +++ b/app/controllers/entries_controller.rb @@ -149,8 +149,8 @@ def edit def update if current_user.is_free? - flash[:alert] = "Subscribe to PRO to edit entries.".html_safe - redirect_to root_path and return + params[:entry][:entry] = @entry.body + params[:entry][:image] = @entry.image end @existing_entry = current_user.existing_entry(params[:entry][:date].to_s) @@ -312,8 +312,8 @@ def respond_to_ai def track_ga_event(action) if ENV['GOOGLE_ANALYTICS_ID'].present? - tracker = Staccato.tracker(ENV['GOOGLE_ANALYTICS_ID']) - tracker.event(category: 'Web Entry', action: action, label: current_user.user_key) + # tracker = Staccato.tracker(ENV['GOOGLE_ANALYTICS_ID']) + # tracker.event(category: 'Web Entry', action: action, label: current_user.user_key) end end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 0b841998..f0929f91 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -129,8 +129,8 @@ def check_captcha def track_ga_event return nil unless user.id.present? if ENV['GOOGLE_ANALYTICS_ID'].present? - tracker = Staccato.tracker(ENV['GOOGLE_ANALYTICS_ID']) - tracker.event(category: 'User', action: 'Create', label: user.user_key) + # tracker = Staccato.tracker(ENV['GOOGLE_ANALYTICS_ID']) + # tracker.event(category: 'User', action: 'Create', label: user.user_key) end end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index f9763881..ec9cd5f4 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -26,8 +26,8 @@ def check_captcha def track_ga_event return nil unless @user.id.present? if ENV['GOOGLE_ANALYTICS_ID'].present? - tracker = Staccato.tracker(ENV['GOOGLE_ANALYTICS_ID']) - tracker.event(category: 'User', action: 'Login', label: @user.user_key) + # tracker = Staccato.tracker(ENV['GOOGLE_ANALYTICS_ID']) + # tracker.event(category: 'User', action: 'Login', label: @user.user_key) end end diff --git a/app/lib/email_processor.rb b/app/lib/email_processor.rb index 9eac4d23..aebf2745 100644 --- a/app/lib/email_processor.rb +++ b/app/lib/email_processor.rb @@ -228,8 +228,8 @@ def respond_as_ai? def track_ga_event(action) if ENV['GOOGLE_ANALYTICS_ID'].present? - tracker = Staccato.tracker(ENV['GOOGLE_ANALYTICS_ID']) - tracker.event(category: 'Email Entry', action: action, label: @user.user_key) + # tracker = Staccato.tracker(ENV['GOOGLE_ANALYTICS_ID']) + # tracker.event(category: 'Email Entry', action: action, label: @user.user_key) end end diff --git a/app/views/entries/edit.html.haml b/app/views/entries/edit.html.haml index e3cbc1ab..08ac1019 100644 --- a/app/views/entries/edit.html.haml +++ b/app/views/entries/edit.html.haml @@ -10,7 +10,7 @@ to unlock the ability to edit entries. .col-md-8.col-md-offset-2.well.s-new-edit-entry{id: "entry-#{@entry.id}"} - %div{class: add_class} + %div .s-entry-date.s-new-entry -if @entry.inspiration.present? .float-left.s-edit-entry{rel: "popover", title: "#{@entry.inspiration.inspired_by}", data: { content: "#{@entry.inspiration.body.html_safe}" }} @@ -39,7 +39,7 @@ = f.text_field :date, value: @entry.date_format_short, placeholder: "October 11 2014", class: "form-control pickadate" %br - %div + %div{class: add_class} - if @entry.image.present? %label @@ -54,7 +54,7 @@ = f.file_field :image, accept: "image/png,image/gif,image/jpeg,image/webp,image/heic,image/heif", multiple: true %br - %div + %div{class: add_class} = f.label :entry = f.text_area :entry, class: "form-control summernote", rows: 15, value: format_body(@entry.formatted_body) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 4dd31038..2280083b 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -19,7 +19,13 @@ /[if lt IE 9] = javascript_include_tag '//oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', 'respond.js' - = analytics_init(anonymize: true) if Rails.env.production? + = javascript_include_tag "https://www.googletagmanager.com/gtag/js?id=#{ENV['GOOGLE_ANALYTICS_4_ID']}", async: true + :javascript + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); + + gtag('config', "#{ENV['GOOGLE_ANALYTICS_4_ID']}"); - if Rails.env.production? = javascript_include_tag "https://www.googletagmanager.com/gtag/js?id=#{ENV['GOOGLE_ANALYTICS_4_ID']}", async: true