solidus_seo 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d8a42d95a51eeb5b6c4860cda59a6e2bb2c7cb4f575da29ea75b4a1fb729e96
4
- data.tar.gz: 22608d6f08eabbfc97b70b9650a96b16c4f79cf1674b3751f3fe650a8d6827c5
3
+ metadata.gz: 4b59bc10f88b145907a907757d59bfa0ddfc1991e7e20313bb4b2b7bb522935f
4
+ data.tar.gz: 879ddd7cbc5884f6eefcfd027d266e8a8c17a707f9312cdf6367970bc9c47d33
5
5
  SHA512:
6
- metadata.gz: ab4aa4274b86aca434eb398bf144eef576632bdf7c5afabe777abfc6091d852b04cef095fc9d6992d71e815043f4fa52e23de8bdff9bc79bd0fb62512f395c26
7
- data.tar.gz: 6ee6fadcea36ed37c9f821310566c5e8f92e25401098b2390c3a3a8eb290042550f683098d020be587f0ef21f187fc8837904b54b5ec063a98aee28af17db601
6
+ metadata.gz: b2f9462a55c124cc5eb2871a8fcdf5c0215bf7fc6280c50295da392f12169c4b2c93a9ca5a13f77291beb4a481fd7de38fb4c25b407e68b83614aab9efa5bbd9
7
+ data.tar.gz: 41787840fd2c469c0103a2f76b53b93586a4c09febbabb9ff82ca1845dfa8c8ed7b035e386e53b2e0cb903873824cd119510784a1a5da53429fb2ae6e088e495
@@ -17,10 +17,10 @@ module Spree
17
17
  end
18
18
 
19
19
  def seo_images
20
- return [] unless display_image.attachment.file?
20
+ return [] unless gallery.images.any? && gallery.images.first.attachment.file?
21
21
 
22
22
  [
23
- url_helper.image_url(display_image.attachment.url(:large), host: store_host),
23
+ url_helper.image_url(gallery.images.first.attachment.url(:large), host: store_host),
24
24
  ].compact
25
25
  end
26
26
 
@@ -25,16 +25,17 @@ if just_purchased
25
25
  end
26
26
  %>
27
27
  <script async src="https://www.googletagmanager.com/gtag/js?id=<%= ENV['GOOGLE_ANALYTICS_ID'] %>"></script>
28
- <script type="text/javascript" data-tag="google-analytics">
29
- window.dataLayer = window.dataLayer || [];
28
+ <script>
29
+ window.dataLayer = window.dataLayer || [];
30
+ function gtag(){dataLayer.push(arguments);}
31
+ gtag('js', new Date());
30
32
 
31
- function gtag(){ dataLayer.push(arguments); }
32
-
33
- gtag('js', new Date());
34
- gtag('config', '<%= ENV['GOOGLE_ANALYTICS_ID'] %>');
35
-
36
- <% if just_purchased %>
37
- gtag('event', 'purchase', <%== order_data.to_json %>);
38
- window.solidusSeoDataLayer('google-analytics', 'purchase');
39
- <% end %>
33
+ gtag('config', '<%= ENV['GOOGLE_ANALYTICS_ID'] %>');
40
34
  </script>
35
+
36
+ <% if just_purchased %>
37
+ <script data-tag="google-analytics">
38
+ gtag('event', 'purchase', <%== order_data.to_json %>);
39
+ window.solidusSeoDataLayer('google-analytics', 'purchase');
40
+ </script>
41
+ <% end %>
@@ -2,49 +2,50 @@
2
2
  return if ENV['GOOGLE_ANALYTICS_ID'].present? || ENV['GOOGLE_TAG_MANAGER_ID'].blank?
3
3
 
4
4
  if just_purchased
5
- order_data = {
6
- id: order.number,
7
- revenue: order.total,
8
- coupon: '', # TODO: Add coupon code if present
5
+ order_data = {
6
+ id: order.number,
7
+ revenue: order.total,
8
+ coupon: '', # TODO: Add coupon code if present
9
9
 
10
- affiliation: current_store.name,
11
- currency: order.currency,
12
- tax: order.tax_total,
13
- shipping: order.ship_total
14
- }
10
+ affiliation: current_store.name,
11
+ currency: order.currency,
12
+ tax: order.tax_total,
13
+ shipping: order.ship_total
14
+ }
15
15
 
16
- purchased_items = order.line_items.map do |line_item|
17
- next unless line_item.variant
16
+ purchased_items = order.line_items.map do |line_item|
17
+ next unless line_item.variant
18
18
 
19
- {
20
- id: line_item.variant.sku,
21
- name: line_item.variant.name,
22
- price: line_item.total,
23
- variant: line_item.variant.options_text,
24
- quantity: line_item.quantity
25
- }
26
- end.compact
19
+ {
20
+ id: line_item.variant.sku,
21
+ name: line_item.variant.name,
22
+ price: line_item.total,
23
+ variant: line_item.variant.options_text,
24
+ quantity: line_item.quantity
25
+ }
26
+ end.compact
27
27
  end
28
28
  %>
29
29
  <script type="text/javascript" data-tag="google-tag-manager">
30
- window.dataLayer = window.dataLayer || [];
30
+ window.dataLayer = window.dataLayer || [];
31
31
 
32
- <% if just_purchased %>
33
- window.dataLayer.push({
34
- 'ecommerce': {
35
- 'purchase': {
36
- 'actionField': <%== order_data.to_json %>,
37
- 'products': <%== purchased_items.to_json %>
38
- }
39
- }
40
- });
41
-
42
- window.solidusSeoDataLayer('google-tag-manager', 'purchase');
43
- <% end %>
32
+ <% if just_purchased %>
33
+ window.dataLayer.push({
34
+ 'ecommerce': {
35
+ 'purchase': {
36
+ 'actionField': <%== order_data.to_json %>,
37
+ 'products': <%== purchased_items.to_json %>
38
+ }
39
+ }
40
+ });
44
41
 
45
- (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
42
+ window.solidusSeoDataLayer('google-tag-manager', 'purchase');
43
+ <% end %>
44
+ </script>
45
+ <script>
46
+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
46
47
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
47
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
48
- 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
49
- })(window,document,'script','dataLayer','<%= ENV['GOOGLE_TAG_MANAGER_ID'] %>');
48
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
49
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
50
+ })(window,document,'script','dataLayer','<%= ENV['GOOGLE_TAG_MANAGER_ID'] %>');
50
51
  </script>
@@ -0,0 +1,7 @@
1
+ <%
2
+ return if ENV['GOOGLE_TAG_MANAGER_ID'].blank?
3
+ %>
4
+ <!-- Google Tag Manager (noscript) -->
5
+ <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<%= ENV['GOOGLE_TAG_MANAGER_ID'] %>"
6
+ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
7
+ <!-- End Google Tag Manager (noscript) -->
@@ -35,6 +35,7 @@ module SolidusSeo
35
35
  copy_file 'insert_product_list_helper.html.erb.deface', 'app/overrides/spree/shared/_products/insert_product_list_helper.html.erb.deface'
36
36
  copy_file 'insert_analytics_in_layout.html.erb.deface', 'app/overrides/spree/layouts/spree_application/insert_analytics_in_layout.html.erb.deface'
37
37
  copy_file 'replace_taxon_breadcrumbs_helper.html.erb.deface', 'app/overrides/spree/layouts/spree_application/replace_taxon_breadcrumbs_helper.html.erb.deface'
38
+ copy_file 'insert_noscript_tags.html.erb.deface', 'app/overrides/spree/layouts/spree_application/insert_noscript_tags.html.erb.deface'
38
39
  end
39
40
  end
40
41
  end
@@ -0,0 +1,4 @@
1
+ <!--
2
+ insert_top "body"
3
+ -->
4
+ <%= render 'solidus_seo/noscript_tags' %>
@@ -43,7 +43,7 @@ module SolidusSeo
43
43
  end
44
44
 
45
45
  def jsonld_fetch(type = :base, items = nil, opts = {})
46
- force = opts.extract!(:force) || false
46
+ force = opts.delete(:force) || false
47
47
 
48
48
  jsonld_cache_key = [:jsonld, items, *opts.values].compact
49
49
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusSeo
4
- VERSION = '1.0.10'
4
+ VERSION = '1.0.11'
5
5
  end
data/spec/examples.txt CHANGED
@@ -1,32 +1,33 @@
1
1
  example_id | status | run_time |
2
2
  ------------------------------------------------ | ------ | --------------- |
3
- ./spec/features/add_to_cart_spec.rb[1:1:1] | passed | 1.83 seconds |
4
- ./spec/features/checkout_complete_spec.rb[1:1:1] | passed | 0.5577 seconds |
5
- ./spec/features/checkout_complete_spec.rb[1:2:1] | passed | 4.04 seconds |
6
- ./spec/features/checkout_complete_spec.rb[1:3:1] | passed | 0.80112 seconds |
7
- ./spec/features/checkout_complete_spec.rb[1:4:1] | passed | 0.61828 seconds |
8
- ./spec/features/homepage_spec.rb[1:1:1] | passed | 0.25538 seconds |
9
- ./spec/features/homepage_spec.rb[1:1:2] | passed | 0.29293 seconds |
10
- ./spec/features/homepage_spec.rb[1:2:1] | passed | 0.22449 seconds |
11
- ./spec/features/homepage_spec.rb[1:2:2] | passed | 0.32462 seconds |
12
- ./spec/features/homepage_spec.rb[1:3:1] | passed | 0.21716 seconds |
13
- ./spec/features/homepage_spec.rb[1:3:2] | passed | 0.19521 seconds |
14
- ./spec/features/product_page_spec.rb[1:1:1] | passed | 0.357 seconds |
15
- ./spec/features/product_page_spec.rb[1:1:2] | passed | 0.3146 seconds |
16
- ./spec/features/product_page_spec.rb[1:1:3] | passed | 0.30766 seconds |
17
- ./spec/features/product_page_spec.rb[1:2:1] | passed | 0.42866 seconds |
18
- ./spec/features/product_page_spec.rb[1:2:2:1] | passed | 0.32146 seconds |
19
- ./spec/features/product_page_spec.rb[1:2:3:1] | passed | 0.34169 seconds |
20
- ./spec/features/product_page_spec.rb[1:3:1] | passed | 3.69 seconds |
21
- ./spec/features/product_page_spec.rb[1:3:2] | passed | 0.33422 seconds |
22
- ./spec/features/product_page_spec.rb[1:3:3] | passed | 0.35778 seconds |
23
- ./spec/features/product_page_spec.rb[1:4:1:1] | passed | 0.83177 seconds |
24
- ./spec/features/taxon_page_spec.rb[1:1:1] | passed | 0.37527 seconds |
25
- ./spec/features/taxon_page_spec.rb[1:1:2] | passed | 0.34972 seconds |
26
- ./spec/features/taxon_page_spec.rb[1:1:3] | passed | 0.34283 seconds |
27
- ./spec/features/taxon_page_spec.rb[1:2:1] | passed | 0.43213 seconds |
28
- ./spec/features/taxon_page_spec.rb[1:2:2:1] | passed | 0.48963 seconds |
29
- ./spec/features/taxon_page_spec.rb[1:2:3:1] | passed | 0.3796 seconds |
30
- ./spec/features/taxon_page_spec.rb[1:3:1] | passed | 0.44923 seconds |
31
- ./spec/features/taxon_page_spec.rb[1:3:2] | passed | 0.35334 seconds |
32
- ./spec/features/taxon_page_spec.rb[1:4:1] | passed | 0.62911 seconds |
3
+ ./spec/features/add_to_cart_spec.rb[1:1:1] | passed | 2.14 seconds |
4
+ ./spec/features/checkout_complete_spec.rb[1:1:1] | passed | 0.59035 seconds |
5
+ ./spec/features/checkout_complete_spec.rb[1:2:1] | passed | 0.70409 seconds |
6
+ ./spec/features/checkout_complete_spec.rb[1:3:1] | passed | 0.77986 seconds |
7
+ ./spec/features/checkout_complete_spec.rb[1:4:1] | passed | 0.53269 seconds |
8
+ ./spec/features/homepage_spec.rb[1:1:1] | passed | 0.27083 seconds |
9
+ ./spec/features/homepage_spec.rb[1:1:2] | passed | 0.2846 seconds |
10
+ ./spec/features/homepage_spec.rb[1:2:1] | passed | 0.26788 seconds |
11
+ ./spec/features/homepage_spec.rb[1:2:2] | passed | 0.26357 seconds |
12
+ ./spec/features/homepage_spec.rb[1:3:1] | passed | 0.2807 seconds |
13
+ ./spec/features/homepage_spec.rb[1:3:2] | passed | 0.28623 seconds |
14
+ ./spec/features/homepage_spec.rb[1:4:1:1] | passed | 0.55629 seconds |
15
+ ./spec/features/product_page_spec.rb[1:1:1] | passed | 0.44472 seconds |
16
+ ./spec/features/product_page_spec.rb[1:1:2] | passed | 0.37428 seconds |
17
+ ./spec/features/product_page_spec.rb[1:1:3] | passed | 0.48305 seconds |
18
+ ./spec/features/product_page_spec.rb[1:2:1] | passed | 0.37207 seconds |
19
+ ./spec/features/product_page_spec.rb[1:2:2:1] | passed | 0.33481 seconds |
20
+ ./spec/features/product_page_spec.rb[1:2:3:1] | passed | 0.35463 seconds |
21
+ ./spec/features/product_page_spec.rb[1:3:1] | passed | 0.40858 seconds |
22
+ ./spec/features/product_page_spec.rb[1:3:2] | passed | 0.39049 seconds |
23
+ ./spec/features/product_page_spec.rb[1:3:3] | passed | 0.43994 seconds |
24
+ ./spec/features/product_page_spec.rb[1:4:1:1] | passed | 4.3 seconds |
25
+ ./spec/features/taxon_page_spec.rb[1:1:1] | passed | 0.40068 seconds |
26
+ ./spec/features/taxon_page_spec.rb[1:1:2] | passed | 0.39674 seconds |
27
+ ./spec/features/taxon_page_spec.rb[1:1:3] | passed | 0.36863 seconds |
28
+ ./spec/features/taxon_page_spec.rb[1:2:1] | passed | 0.46435 seconds |
29
+ ./spec/features/taxon_page_spec.rb[1:2:2:1] | passed | 0.38776 seconds |
30
+ ./spec/features/taxon_page_spec.rb[1:2:3:1] | passed | 0.36313 seconds |
31
+ ./spec/features/taxon_page_spec.rb[1:3:1] | passed | 0.39374 seconds |
32
+ ./spec/features/taxon_page_spec.rb[1:3:2] | passed | 0.36606 seconds |
33
+ ./spec/features/taxon_page_spec.rb[1:4:1] | passed | 0.585 seconds |
@@ -59,4 +59,19 @@ describe "Homepage", type: :system do
59
59
  expect(page).to have_css "meta[property='og:description'][content='#{seo_description}']", visible: false
60
60
  end
61
61
  end
62
+
63
+ context 'noscript tags' do
64
+ context 'when GOOGLE_TAG_MANAGER_ID is present' do
65
+ let(:env_variable) { 'GOOGLE_TAG_MANAGER_ID' }
66
+
67
+ before do
68
+ stub_const 'ENV', ENV.to_h.merge(env_variable => 'XXX-YYYYY')
69
+ end
70
+
71
+ it 'contains noscript tag for GTM' do
72
+ subject
73
+ expect(page).to have_text :all, "https://www.googletagmanager.com/ns.html"
74
+ end
75
+ end
76
+ end
62
77
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_seo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karma Creative
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2021-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -346,6 +346,7 @@ files:
346
346
  - app/views/solidus_seo/_facebook.html.erb
347
347
  - app/views/solidus_seo/_google-analytics.html.erb
348
348
  - app/views/solidus_seo/_google-tag-manager.html.erb
349
+ - app/views/solidus_seo/_noscript_tags.html.erb
349
350
  - app/views/solidus_seo/_pinterest.html.erb
350
351
  - config/locales/en.yml
351
352
  - config/routes.rb
@@ -354,6 +355,7 @@ files:
354
355
  - lib/generators/solidus_seo/install/templates/insert_analytics_in_layout.html.erb.deface
355
356
  - lib/generators/solidus_seo/install/templates/insert_display_meta_tags_helper.html.erb.deface
356
357
  - lib/generators/solidus_seo/install/templates/insert_dump_jsonld_helper.html.erb.deface
358
+ - lib/generators/solidus_seo/install/templates/insert_noscript_tags.html.erb.deface
357
359
  - lib/generators/solidus_seo/install/templates/insert_product_jsonld_helper.html.erb.deface
358
360
  - lib/generators/solidus_seo/install/templates/insert_product_list_helper.html.erb.deface
359
361
  - lib/generators/solidus_seo/install/templates/paperclip_optimizer.rb