From 248b0016d4a591022bca406e8ed7bd70aa98d3b3 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Sat, 4 Apr 2020 09:40:54 +0100 Subject: [PATCH] Remove trackers and google analytics --- app/views/layouts/darkswarm.html.haml | 1 - .../shared/_configuration_menu.html.haml | 1 - app/views/spree/admin/shared/_tabs.html.haml | 2 +- app/views/spree/layouts/_admin_body.html.haml | 2 - .../spree/shared/_google_analytics.html.erb | 39 ------------------- config/locales/en.yml | 7 ---- config/routes/spree.rb | 1 - .../20200404083008_drop_trackers_table.rb | 14 +++++++ db/schema.rb | 9 ----- 9 files changed, 15 insertions(+), 61 deletions(-) delete mode 100644 app/views/spree/shared/_google_analytics.html.erb create mode 100644 db/migrate/20200404083008_drop_trackers_table.rb diff --git a/app/views/layouts/darkswarm.html.haml b/app/views/layouts/darkswarm.html.haml index fa42b8f745..1f92137e9e 100644 --- a/app/views/layouts/darkswarm.html.haml +++ b/app/views/layouts/darkswarm.html.haml @@ -56,4 +56,3 @@ = render "layouts/bugherd_script" = render "layouts/matomo_tag" - = render 'spree/shared/google_analytics' diff --git a/app/views/spree/admin/shared/_configuration_menu.html.haml b/app/views/spree/admin/shared/_configuration_menu.html.haml index 7ec62c516e..5810cc97b2 100644 --- a/app/views/spree/admin/shared/_configuration_menu.html.haml +++ b/app/views/spree/admin/shared/_configuration_menu.html.haml @@ -20,7 +20,6 @@ = configurations_sidebar_menu_item Spree.t(:shipping_methods), admin_shipping_methods_path = configurations_sidebar_menu_item Spree.t(:shipping_categories), admin_shipping_categories_path = configurations_sidebar_menu_item t(:enterprise_fees), main_app.admin_enterprise_fees_path - = configurations_sidebar_menu_item Spree.t(:analytics_trackers), admin_trackers_path = configurations_sidebar_menu_item t('admin.contents.edit.title'), main_app.edit_admin_contents_path = configurations_sidebar_menu_item t('admin.invoice_settings.edit.title'), main_app.edit_admin_invoice_settings_path = configurations_sidebar_menu_item t('admin.matomo_settings.edit.title'), main_app.edit_admin_matomo_settings_path diff --git a/app/views/spree/admin/shared/_tabs.html.haml b/app/views/spree/admin/shared/_tabs.html.haml index 219305ca40..920480fc8b 100644 --- a/app/views/spree/admin/shared/_tabs.html.haml +++ b/app/views/spree/admin/shared/_tabs.html.haml @@ -3,7 +3,7 @@ = tab :order_cycles, url: main_app.admin_order_cycles_path, icon: 'icon-refresh' = tab :orders, :subscriptions, :customer_details, :adjustments, :payments, :return_authorizations, url: admin_orders_path('q[s]' => 'completed_at desc'), icon: 'icon-shopping-cart' = tab :reports, icon: 'icon-file' -= tab :general_settings, :mail_method, :image_settings, :tax_categories, :tax_rates, :tax_settings, :zones, :countries, :states, :payment_methods, :taxonomies, :shipping_methods, :shipping_categories, :enterprise_fees, :trackers, :contents, :invoice_settings, :matomo_settings, :stripe_connect_settings, label: 'configuration', icon: 'icon-wrench', url: edit_admin_general_settings_path += tab :general_settings, :mail_method, :image_settings, :tax_categories, :tax_rates, :tax_settings, :zones, :countries, :states, :payment_methods, :taxonomies, :shipping_methods, :shipping_categories, :enterprise_fees, :contents, :invoice_settings, :matomo_settings, :stripe_connect_settings, label: 'configuration', icon: 'icon-wrench', url: edit_admin_general_settings_path = tab :enterprises, :enterprise_relationships, url: main_app.admin_enterprises_path = tab :customers, url: main_app.admin_customers_path = tab :enterprise_groups, url: main_app.admin_enterprise_groups_path, label: 'groups' diff --git a/app/views/spree/layouts/_admin_body.html.haml b/app/views/spree/layouts/_admin_body.html.haml index 0d7c17c5ba..6fb035c825 100644 --- a/app/views/spree/layouts/_admin_body.html.haml +++ b/app/views/spree/layouts/_admin_body.html.haml @@ -70,7 +70,5 @@ %div{"data-hook" => "admin_footer_scripts"} -= render 'spree/shared/google_analytics' - %script = raw "Spree.api_key = \"#{try_spree_current_user.try(:spree_api_key).to_s}\";" diff --git a/app/views/spree/shared/_google_analytics.html.erb b/app/views/spree/shared/_google_analytics.html.erb deleted file mode 100644 index 3098059e9c..0000000000 --- a/app/views/spree/shared/_google_analytics.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<% if tracker = Spree::Tracker.current %> - - <%= javascript_tag do %> - var _gaq = _gaq || []; - _gaq.push(['_setAccount', '<%= tracker.analytics_id %>']); - _gaq.push(['_trackPageview']); - - <% if flash[:commerce_tracking] && @order.present? %> - <%# more info: https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce %> - _gaq.push(['_addTrans', - "<%= j @order.number %>", - "", - "<%= @order.total %>", - "<%= @order.adjustments.tax.sum(:amount) %>", - "<%= @order.adjustments.shipping.sum(:amount) %>", - "<%= j @order.bill_address.city %>", - "<%= j @order.bill_address.state_text %>", - "<%= j @order.bill_address.country.name %>" - ]); - <% @order.line_items.each do |line_item| %> - _gaq.push(['_addItem', - "<%= j @order.number %>", - "<%= j line_item.variant.sku %>", - "<%= j line_item.variant.product.name %>", - "", - "<%= line_item.price %>", - "<%= line_item.quantity %>" - ]); - <% end %> - _gaq.push(['_trackTrans']); - <% end %> - - (function() { - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = '//google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); - })(); - <% end %> -<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 81a542820b..ee29d4522a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3035,13 +3035,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using new_shipping_category: "New Shipping Category" back_to_shipping_categories: "Back To Shipping Categories" - analytics_trackers: "Analytics Trackers" - no_trackers_found: "No Trackers Found" - new_tracker: "New Tracker" - add_one: "Add One" - google_analytics_id: "Analytics ID" - back_to_trackers_list: "Back to Trackers List" - name: "Name" description: "Description" type: "Type" diff --git a/config/routes/spree.rb b/config/routes/spree.rb index 1fb8d9c1d0..fc0de19a10 100644 --- a/config/routes/spree.rb +++ b/config/routes/spree.rb @@ -136,7 +136,6 @@ Spree::Core::Engine.routes.draw do end resource :image_settings - resources :trackers resources :zones resources :countries do diff --git a/db/migrate/20200404083008_drop_trackers_table.rb b/db/migrate/20200404083008_drop_trackers_table.rb new file mode 100644 index 0000000000..4dca8c7cfc --- /dev/null +++ b/db/migrate/20200404083008_drop_trackers_table.rb @@ -0,0 +1,14 @@ +class DropTrackersTable < ActiveRecord::Migration + def up + drop_table :spree_trackers + end + + def down + create_table :spree_trackers do |t| + t.string :environment + t.string :analytics_id + t.boolean :active, :default => true + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 2d1980fcca..b00e0bf89e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,6 @@ # It's strongly recommended to check this file into your version control system. ActiveRecord::Schema.define(:version => 20200406085833) do - create_table "adjustment_metadata", :force => true do |t| t.integer "adjustment_id" t.integer "enterprise_id" @@ -1011,14 +1010,6 @@ ActiveRecord::Schema.define(:version => 20200406085833) do add_index "spree_tokenized_permissions", ["permissable_id", "permissable_type"], :name => "index_tokenized_name_and_type" - create_table "spree_trackers", :force => true do |t| - t.string "environment" - t.string "analytics_id" - t.boolean "active", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "spree_users", :force => true do |t| t.string "encrypted_password" t.string "password_salt"