solidus_seo 1.0.11 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/app/decorators/controllers/spree/checkout_controller_decorator.rb +23 -0
- data/app/views/solidus_seo/_facebook.html.erb +65 -18
- data/app/views/solidus_seo/_google-analytics.html.erb +5 -5
- data/app/views/solidus_seo/_google-tag-manager.html.erb +22 -22
- data/app/views/solidus_seo/_pinterest.html.erb +45 -44
- data/lib/generators/solidus_seo/install/install_generator.rb +1 -0
- data/lib/generators/solidus_seo/install/templates/replace_flash_messages_helper.html.erb.deface +5 -0
- data/lib/solidus_seo/version.rb +1 -1
- data/spec/examples.txt +40 -33
- data/spec/features/add_to_cart_spec.rb +15 -1
- data/spec/features/checkout_complete_spec.rb +5 -5
- data/spec/features/checkout_initiated_spec.rb +53 -0
- data/spec/features/homepage_spec.rb +1 -1
- data/spec/features/product_page_spec.rb +12 -1
- data/spec/features/taxon_page_spec.rb +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 216bf7f2c50a2e4513308e4aa12f7f3685f4aa01621ffc2f8d0a025a4a4b88d2
|
4
|
+
data.tar.gz: f7106060098a781ec08ba7c02447738d511e39bf0c3be675aafc1a4b837aa69c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89bd816d982a8d8c8358f2e769ad5d030ce141097e0067a6b585e0bdfb3454ba88bf08c129c913baf6c5754c3465b8040cb22bb7c00db36f28aabc650340e1b2
|
7
|
+
data.tar.gz: 6c05b6024066f4a6b36299f077883fc2086a0b9fba78415368a8b55662142214bdd006486330c821c4a94496aa699e581f2f6cfeb1a6e155bdc30d00782f6b76
|
data/README.md
CHANGED
@@ -45,8 +45,10 @@ Here are the changes we make, via deface, in the default Solidus views as part o
|
|
45
45
|
|
46
46
|
- In `spree/layouts/spree_application.html.erb`
|
47
47
|
- Insert `<%= render 'solidus_seo/analytics' %>` just before `</head>`.
|
48
|
+
- Insert `<%= render 'solidus_seo/noscript_tags' %>` immediately after the `<body>` opening tag.
|
48
49
|
- Insert `<%= dump_jsonld %>` just before the `</body>` closing tag.
|
49
50
|
- Replace `<%= taxon_breadcrumbs(@taxon) %>` with (`<%= taxon_breadcrumbs_jsonld(@taxon) %>`) which does the same as the original plus prints a JSON-LD tag.
|
51
|
+
- Replace `<%= flash_messages %>` with (`<%= flash_messages(ignore_types: 'added_to_cart') %>`) which does the same as the original plus prints a JSON-LD tag.
|
50
52
|
|
51
53
|
- In `spree/products/show.html.erb`:
|
52
54
|
- Insert `<%= jsonld @product %>` anywhere inside the `cache` block.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
module CheckoutControllerDecorator
|
5
|
+
def self.prepended(base)
|
6
|
+
base.class_eval do
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def before_address
|
11
|
+
flash[:checkout_initiated] =
|
12
|
+
@order.address? &&
|
13
|
+
request.referrer =~ /#{cart_path}\b/i &&
|
14
|
+
params[:action] == 'edit'
|
15
|
+
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
::Spree::StoreController.prepend(self)
|
22
|
+
end
|
23
|
+
end
|
@@ -1,25 +1,57 @@
|
|
1
1
|
<%
|
2
2
|
return if ENV['FACEBOOK_PIXEL_ID'].blank?
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
event_data = {}
|
5
|
+
|
6
|
+
if order.present?
|
7
|
+
if just_purchased
|
8
|
+
event_data[:order] = {
|
9
|
+
value: order.total,
|
10
|
+
currency: order.currency,
|
11
|
+
content_type: 'product',
|
12
|
+
contents: order.line_items.map do |line_item|
|
13
|
+
{ id: line_item.variant.sku, quantity: line_item.quantity }
|
14
|
+
end,
|
15
|
+
|
16
|
+
# custom properties
|
17
|
+
order_number: order.number,
|
18
|
+
item_total: order.item_total,
|
19
|
+
tax_total: order.tax_total,
|
20
|
+
ship_total: order.ship_total,
|
21
|
+
promo_total: order.promo_total
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
if flash[:added_to_cart].present?
|
26
|
+
event_data[:added_to_cart] = {
|
27
|
+
currency: order.currency,
|
28
|
+
content_type: 'product',
|
29
|
+
contents: flash[:added_to_cart].map do |variant_sku, variant|
|
30
|
+
{ id: variant_sku, quantity: variant['quantity'] }
|
31
|
+
end
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
if flash[:checkout_initiated].present?
|
36
|
+
event_data[:checkout_initiated] = {
|
37
|
+
value: order.total,
|
38
|
+
currency: order.currency,
|
39
|
+
content_type: 'product',
|
40
|
+
contents: order.line_items.map do |line_item|
|
41
|
+
{ id: line_item.variant.sku, quantity: line_item.quantity }
|
42
|
+
end
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
if @product
|
48
|
+
event_data[:current_product] = {
|
8
49
|
content_type: 'product',
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
{ id: line_item.variant.sku, quantity: line_item.quantity }
|
13
|
-
end.compact,
|
14
|
-
|
15
|
-
# custom properties
|
16
|
-
order_number: order.number,
|
17
|
-
item_total: order.item_total,
|
18
|
-
tax_total: order.tax_total,
|
19
|
-
ship_total: order.ship_total,
|
20
|
-
promo_total: order.promo_total
|
50
|
+
content_name: @product.name,
|
51
|
+
content_ids: [@product.master.sku]
|
21
52
|
}
|
22
53
|
end
|
54
|
+
|
23
55
|
%>
|
24
56
|
<script type="text/javascript" data-tag="facebook">
|
25
57
|
!function(f,b,e,v,n,t,s) {if (f.fbq) return;n = f.fbq = function() { n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments) };if (!f._fbq) f._fbq=n;n.push = n; n.loaded = !0; n.version = '2.0'; n.queue=[]; t = b.createElement(e); t.async = !0; t.src = v;s = b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t, s);}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js');
|
@@ -27,10 +59,25 @@ end
|
|
27
59
|
fbq('init', '<%= ENV['FACEBOOK_PIXEL_ID'] %>');
|
28
60
|
fbq('track', 'PageView');
|
29
61
|
|
30
|
-
<% if
|
31
|
-
fbq('track', 'Purchase', <%==
|
62
|
+
<% if event_data[:order].present? %>
|
63
|
+
fbq('track', 'Purchase', <%== event_data[:order].to_json %>);
|
32
64
|
window.solidusSeoDataLayer('facebook', 'purchase');
|
33
65
|
<% end %>
|
66
|
+
|
67
|
+
<% if event_data[:added_to_cart].present? %>
|
68
|
+
fbq('track', 'AddToCart', <%== event_data[:added_to_cart].to_json %>);
|
69
|
+
window.solidusSeoDataLayer('facebook', 'addtocart');
|
70
|
+
<% end %>
|
71
|
+
|
72
|
+
<% if event_data[:checkout_initiated].present? %>
|
73
|
+
fbq('track', 'InitiateCheckout', <%== event_data[:checkout_initiated].to_json %>);
|
74
|
+
window.solidusSeoDataLayer('facebook', 'initiatecheckout');
|
75
|
+
<% end %>
|
76
|
+
|
77
|
+
<% if event_data[:current_product].present? %>
|
78
|
+
fbq('track', 'ViewContent', <%== event_data[:current_product].to_json %>);
|
79
|
+
window.solidusSeoDataLayer('facebook', 'viewcontent');
|
80
|
+
<% end %>
|
34
81
|
</script>
|
35
82
|
<noscript>
|
36
83
|
<img height="1" width="1" src="https://www.facebook.com/tr?id=<%= ENV['FACEBOOK_PIXEL_ID'] %>&ev=PageView&noscript=1" />
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<%
|
2
2
|
return if ENV['GOOGLE_TAG_MANAGER_ID'].present? || ENV['GOOGLE_ANALYTICS_ID'].blank?
|
3
3
|
|
4
|
+
event_data = {}
|
5
|
+
|
4
6
|
if just_purchased
|
5
|
-
|
7
|
+
event_data[:order] = {
|
6
8
|
transaction_id: order.number,
|
7
9
|
value: order.total,
|
8
10
|
items: order.line_items.map do |line_item|
|
9
|
-
next unless line_item.variant
|
10
|
-
|
11
11
|
{
|
12
12
|
id: line_item.variant.sku,
|
13
13
|
name: line_item.variant.name,
|
@@ -15,7 +15,7 @@ if just_purchased
|
|
15
15
|
variant: line_item.variant.options_text,
|
16
16
|
quantity: line_item.quantity
|
17
17
|
}
|
18
|
-
end
|
18
|
+
end,
|
19
19
|
|
20
20
|
affiliation: current_store.name,
|
21
21
|
currency: order.currency,
|
@@ -35,7 +35,7 @@ end
|
|
35
35
|
|
36
36
|
<% if just_purchased %>
|
37
37
|
<script data-tag="google-analytics">
|
38
|
-
gtag('event', 'purchase', <%==
|
38
|
+
gtag('event', 'purchase', <%== event_data[:order].to_json %>);
|
39
39
|
window.solidusSeoDataLayer('google-analytics', 'purchase');
|
40
40
|
</script>
|
41
41
|
<% end %>
|
@@ -1,29 +1,29 @@
|
|
1
1
|
<%
|
2
2
|
return if ENV['GOOGLE_ANALYTICS_ID'].present? || ENV['GOOGLE_TAG_MANAGER_ID'].blank?
|
3
3
|
|
4
|
-
|
5
|
-
order_data = {
|
6
|
-
id: order.number,
|
7
|
-
revenue: order.total,
|
8
|
-
coupon: '', # TODO: Add coupon code if present
|
9
|
-
|
10
|
-
affiliation: current_store.name,
|
11
|
-
currency: order.currency,
|
12
|
-
tax: order.tax_total,
|
13
|
-
shipping: order.ship_total
|
14
|
-
}
|
4
|
+
event_data = {}
|
15
5
|
|
16
|
-
|
17
|
-
|
6
|
+
if just_purchased
|
7
|
+
event_data[:order] = {
|
8
|
+
id: order.number,
|
9
|
+
revenue: order.total,
|
10
|
+
coupon: order.adjustments.promotion.first&.promotion_code&.value,
|
18
11
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
variant: line_item.variant.options_text,
|
24
|
-
quantity: line_item.quantity
|
12
|
+
affiliation: current_store.name,
|
13
|
+
currency: order.currency,
|
14
|
+
tax: order.tax_total,
|
15
|
+
shipping: order.ship_total
|
25
16
|
}
|
26
|
-
|
17
|
+
|
18
|
+
event_data[:order_contents] = order.line_items.map do |line_item|
|
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
|
27
27
|
end
|
28
28
|
%>
|
29
29
|
<script type="text/javascript" data-tag="google-tag-manager">
|
@@ -33,8 +33,8 @@ end
|
|
33
33
|
window.dataLayer.push({
|
34
34
|
'ecommerce': {
|
35
35
|
'purchase': {
|
36
|
-
'actionField': <%==
|
37
|
-
'products': <%==
|
36
|
+
'actionField': <%== event_data[:order].to_json %>,
|
37
|
+
'products': <%== event_data[:order_contents].to_json %>
|
38
38
|
}
|
39
39
|
}
|
40
40
|
});
|
@@ -1,38 +1,55 @@
|
|
1
1
|
<%
|
2
2
|
return if ENV['PINTEREST_TAG_ID'].blank?
|
3
3
|
|
4
|
-
|
5
|
-
add_to_cart_data = {}
|
6
|
-
order_data = {}
|
7
|
-
em_data = {}
|
4
|
+
event_data = {}
|
8
5
|
|
9
6
|
user_email = try_spree_current_user&.email || current_order&.email
|
10
7
|
if user_email.present?
|
11
8
|
em_data = { em: user_email }
|
12
9
|
end
|
13
10
|
|
14
|
-
if
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
11
|
+
if order.present?
|
12
|
+
if just_purchased
|
13
|
+
event_data[:order] = {
|
14
|
+
value: order.total,
|
15
|
+
currency: order.currency,
|
16
|
+
order_quantity: order.line_items.sum(&:quantity),
|
17
|
+
line_items: order.line_items.map do |line_item|
|
18
|
+
next unless line_item.variant
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
20
|
+
{
|
21
|
+
product_id: line_item.variant.product.master.sku,
|
22
|
+
product_name: line_item.variant.name,
|
23
|
+
product_variant_id: line_item.variant.sku,
|
24
|
+
product_variant: line_item.variant.options_text,
|
25
|
+
product_quantity: line_item.quantity,
|
26
|
+
product_price: line_item.price
|
27
|
+
}
|
28
|
+
end.compact
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
if flash[:added_to_cart].present?
|
33
|
+
event_data[:added_to_cart] = {
|
34
|
+
value: order.total,
|
35
|
+
currency: order.currency,
|
36
|
+
order_id: order.number,
|
37
|
+
line_items: flash[:added_to_cart].map do |variant_sku, variant|
|
38
|
+
{
|
39
|
+
product_id: variant['id'],
|
40
|
+
product_name: variant['name'],
|
41
|
+
product_variant_id: variant_sku,
|
42
|
+
product_variant: variant['variant'],
|
43
|
+
product_price: variant['price'],
|
44
|
+
product_quantity: variant['quantity']
|
45
|
+
}
|
46
|
+
end
|
47
|
+
}
|
48
|
+
end
|
32
49
|
end
|
33
50
|
|
34
51
|
if @product
|
35
|
-
|
52
|
+
event_data[:product] = {
|
36
53
|
line_items: [
|
37
54
|
{
|
38
55
|
product_name: @product.name,
|
@@ -42,23 +59,7 @@ if @product
|
|
42
59
|
}
|
43
60
|
end
|
44
61
|
|
45
|
-
|
46
|
-
add_to_cart_data = {
|
47
|
-
value: order.total,
|
48
|
-
currency: order.currency,
|
49
|
-
order_id: order.number,
|
50
|
-
line_items: flash[:added_to_cart].map do |variant_sku, variant|
|
51
|
-
{
|
52
|
-
product_id: variant['id'],
|
53
|
-
product_name: variant['name'],
|
54
|
-
product_variant_id: variant_sku,
|
55
|
-
product_variant: variant['variant'],
|
56
|
-
product_price: variant['price'],
|
57
|
-
product_quantity: variant['quantity']
|
58
|
-
}
|
59
|
-
end
|
60
|
-
}
|
61
|
-
end
|
62
|
+
|
62
63
|
%>
|
63
64
|
<script type="text/javascript" data-tag="pinterest">
|
64
65
|
!function(e){if(!window.pintrk){window.pintrk=function(){window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var n=window.pintrk;n.queue=[],n.version="3.0";var t=document.createElement("script");t.async=!0,t.src=e;var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}}("https://s.pinimg.com/ct/core.js");
|
@@ -66,16 +67,16 @@ end
|
|
66
67
|
pintrk('load', '<%= ENV['PINTEREST_TAG_ID'] %>' <%== em_data.present? ? ", #{em_data.to_json}" : '' %>);
|
67
68
|
pintrk('page');
|
68
69
|
|
69
|
-
pintrk('track', 'pagevisit'<%==
|
70
|
+
pintrk('track', 'pagevisit'<%== event_data[:product].present? ? ", #{event_data[:product].to_json}" : '' %>);
|
70
71
|
window.solidusSeoDataLayer('pinterest', 'pagevisit');
|
71
72
|
|
72
|
-
<% if
|
73
|
-
pintrk('track', 'addtocart', <%==
|
73
|
+
<% if event_data[:added_to_cart].present? %>
|
74
|
+
pintrk('track', 'addtocart', <%== event_data[:added_to_cart].to_json %>);
|
74
75
|
window.solidusSeoDataLayer('pinterest', 'addtocart');
|
75
76
|
<% end %>
|
76
77
|
|
77
|
-
<% if
|
78
|
-
pintrk('track', 'checkout', <%==
|
78
|
+
<% if event_data[:order].present? %>
|
79
|
+
pintrk('track', 'checkout', <%== event_data[:order].to_json %>);
|
79
80
|
window.solidusSeoDataLayer('pinterest', 'purchase');
|
80
81
|
<% end %>
|
81
82
|
</script>
|
@@ -36,6 +36,7 @@ module SolidusSeo
|
|
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
38
|
copy_file 'insert_noscript_tags.html.erb.deface', 'app/overrides/spree/layouts/spree_application/insert_noscript_tags.html.erb.deface'
|
39
|
+
copy_file 'replace_flash_messages_helper.html.erb.deface', 'app/overrides/spree/layouts/spree_application/replace_flash_messages_helper.html.erb.deface'
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
data/lib/solidus_seo/version.rb
CHANGED
data/spec/examples.txt
CHANGED
@@ -1,33 +1,40 @@
|
|
1
|
-
example_id
|
2
|
-
|
3
|
-
./spec/features/add_to_cart_spec.rb[1:1:1]
|
4
|
-
./spec/features/
|
5
|
-
./spec/features/
|
6
|
-
./spec/features/checkout_complete_spec.rb[1:
|
7
|
-
./spec/features/checkout_complete_spec.rb[1:
|
8
|
-
./spec/features/
|
9
|
-
./spec/features/
|
10
|
-
./spec/features/
|
11
|
-
./spec/features/
|
12
|
-
./spec/features/
|
13
|
-
./spec/features/
|
14
|
-
./spec/features/homepage_spec.rb[1:
|
15
|
-
./spec/features/
|
16
|
-
./spec/features/
|
17
|
-
./spec/features/
|
18
|
-
./spec/features/
|
19
|
-
./spec/features/
|
20
|
-
./spec/features/
|
21
|
-
./spec/features/product_page_spec.rb[1:
|
22
|
-
./spec/features/product_page_spec.rb[1:
|
23
|
-
./spec/features/product_page_spec.rb[1:
|
24
|
-
./spec/features/product_page_spec.rb[1:
|
25
|
-
./spec/features/
|
26
|
-
./spec/features/
|
27
|
-
./spec/features/
|
28
|
-
./spec/features/
|
29
|
-
./spec/features/
|
30
|
-
./spec/features/
|
31
|
-
./spec/features/
|
32
|
-
./spec/features/taxon_page_spec.rb[1:
|
33
|
-
./spec/features/taxon_page_spec.rb[1:
|
1
|
+
example_id | status | run_time |
|
2
|
+
------------------------------------------------- | ------- | --------------- |
|
3
|
+
./spec/features/add_to_cart_spec.rb[1:1:1] | passed | 0.70714 seconds |
|
4
|
+
./spec/features/add_to_cart_spec.rb[1:2:1] | passed | 0.91242 seconds |
|
5
|
+
./spec/features/add_to_cart_spec.rb[1:2:2] | passed | 0.81584 seconds |
|
6
|
+
./spec/features/checkout_complete_spec.rb[1:1:1] | passed | 0.79057 seconds |
|
7
|
+
./spec/features/checkout_complete_spec.rb[1:2:1] | passed | 0.60349 seconds |
|
8
|
+
./spec/features/checkout_complete_spec.rb[1:3:1] | passed | 0.67453 seconds |
|
9
|
+
./spec/features/checkout_complete_spec.rb[1:4:1] | passed | 1.34 seconds |
|
10
|
+
./spec/features/checkout_initiated_spec.rb[1:1:1] | pending | 4.43 seconds |
|
11
|
+
./spec/features/checkout_initiated_spec.rb[1:2:1] | pending | 0.14919 seconds |
|
12
|
+
./spec/features/checkout_initiated_spec.rb[1:3:1] | passed | 4.36 seconds |
|
13
|
+
./spec/features/checkout_initiated_spec.rb[1:4:1] | pending | 0.1462 seconds |
|
14
|
+
./spec/features/homepage_spec.rb[1:1:1] | passed | 0.29976 seconds |
|
15
|
+
./spec/features/homepage_spec.rb[1:1:2] | passed | 0.27 seconds |
|
16
|
+
./spec/features/homepage_spec.rb[1:2:1] | passed | 0.27712 seconds |
|
17
|
+
./spec/features/homepage_spec.rb[1:2:2] | passed | 0.2885 seconds |
|
18
|
+
./spec/features/homepage_spec.rb[1:3:1] | passed | 0.2833 seconds |
|
19
|
+
./spec/features/homepage_spec.rb[1:3:2] | passed | 0.34543 seconds |
|
20
|
+
./spec/features/homepage_spec.rb[1:4:1:1] | passed | 0.34652 seconds |
|
21
|
+
./spec/features/product_page_spec.rb[1:1:1] | passed | 0.49201 seconds |
|
22
|
+
./spec/features/product_page_spec.rb[1:1:2] | passed | 0.33732 seconds |
|
23
|
+
./spec/features/product_page_spec.rb[1:1:3] | passed | 0.44211 seconds |
|
24
|
+
./spec/features/product_page_spec.rb[1:2:1] | passed | 0.33363 seconds |
|
25
|
+
./spec/features/product_page_spec.rb[1:2:2:1] | passed | 0.37959 seconds |
|
26
|
+
./spec/features/product_page_spec.rb[1:2:3:1] | passed | 0.35276 seconds |
|
27
|
+
./spec/features/product_page_spec.rb[1:3:1] | passed | 0.38382 seconds |
|
28
|
+
./spec/features/product_page_spec.rb[1:3:2] | passed | 0.44302 seconds |
|
29
|
+
./spec/features/product_page_spec.rb[1:3:3] | passed | 0.3563 seconds |
|
30
|
+
./spec/features/product_page_spec.rb[1:4:1:1] | passed | 0.43342 seconds |
|
31
|
+
./spec/features/product_page_spec.rb[1:4:2:1] | passed | 0.51922 seconds |
|
32
|
+
./spec/features/taxon_page_spec.rb[1:1:1] | passed | 0.37215 seconds |
|
33
|
+
./spec/features/taxon_page_spec.rb[1:1:2] | passed | 0.3999 seconds |
|
34
|
+
./spec/features/taxon_page_spec.rb[1:1:3] | passed | 0.41779 seconds |
|
35
|
+
./spec/features/taxon_page_spec.rb[1:2:1] | passed | 0.40682 seconds |
|
36
|
+
./spec/features/taxon_page_spec.rb[1:2:2:1] | passed | 0.34453 seconds |
|
37
|
+
./spec/features/taxon_page_spec.rb[1:2:3:1] | passed | 0.39064 seconds |
|
38
|
+
./spec/features/taxon_page_spec.rb[1:3:1] | passed | 0.33643 seconds |
|
39
|
+
./spec/features/taxon_page_spec.rb[1:3:2] | passed | 0.43755 seconds |
|
40
|
+
./spec/features/taxon_page_spec.rb[1:4:1] | passed | 0.63277 seconds |
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe 'Add to cart', type: :system do
|
4
|
-
let!(:store) {
|
4
|
+
let!(:store) { create(:store) }
|
5
5
|
let!(:order) { create :completed_order_with_totals }
|
6
6
|
let!(:line_item) { order.line_items.first }
|
7
7
|
|
@@ -15,6 +15,16 @@ describe 'Add to cart', type: :system do
|
|
15
15
|
find('#add-to-cart-button').click
|
16
16
|
end
|
17
17
|
|
18
|
+
context 'when FACEBOOK_PIXEL_ID environment variable is present' do
|
19
|
+
let(:env_variable) { 'FACEBOOK_PIXEL_ID' }
|
20
|
+
|
21
|
+
it 'tracks "add to cart" event with product data' do
|
22
|
+
expect(page).to track_analytics_event :facebook, 'addtocart', [
|
23
|
+
'fbq', 'track', 'AddToCart', line_item.sku
|
24
|
+
]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
18
28
|
context 'when PINTEREST_TAG_ID environment variable is present' do
|
19
29
|
let(:env_variable) { 'PINTEREST_TAG_ID' }
|
20
30
|
|
@@ -24,6 +34,10 @@ describe 'Add to cart', type: :system do
|
|
24
34
|
line_item.name, line_item.variant.sku, line_item.variant.price
|
25
35
|
]
|
26
36
|
end
|
37
|
+
|
38
|
+
it 'skips printing a flash message to the user with added_to_cart raw data' do
|
39
|
+
expect(page).to_not have_css '.flash.added_to_cart'
|
40
|
+
end
|
27
41
|
end
|
28
42
|
end
|
29
43
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
describe 'Checkout complete', type: :system do
|
4
|
-
let!(:store) {
|
4
|
+
let!(:store) { create(:store) }
|
5
5
|
let!(:taxon) { create :taxon, name: 'MyTaxon' }
|
6
6
|
let!(:order) { create :completed_order_with_totals }
|
7
7
|
let!(:line_item) { order.line_items.first }
|
@@ -19,7 +19,7 @@ describe 'Checkout complete', type: :system do
|
|
19
19
|
context 'when GOOGLE_TAG_MANAGER_ID environment variable is present' do
|
20
20
|
let(:env_variable) { 'GOOGLE_TAG_MANAGER_ID' }
|
21
21
|
|
22
|
-
it '
|
22
|
+
it 'tracks "purchase" event with product data' do
|
23
23
|
subject
|
24
24
|
expect(page).to track_analytics_event 'google-tag-manager', 'purchase', ['ecommerce', 'purchase', order.number, order.total, line_item.sku]
|
25
25
|
end
|
@@ -28,7 +28,7 @@ describe 'Checkout complete', type: :system do
|
|
28
28
|
context 'when GOOGLE_ANALYTICS_ID environment variable is present' do
|
29
29
|
let(:env_variable) { 'GOOGLE_ANALYTICS_ID' }
|
30
30
|
|
31
|
-
it '
|
31
|
+
it 'tracks "purchase" event with product data' do
|
32
32
|
subject
|
33
33
|
expect(page).to track_analytics_event 'google-analytics', 'purchase', [
|
34
34
|
'event', 'purchase', 'transaction_id', order.number,
|
@@ -41,7 +41,7 @@ describe 'Checkout complete', type: :system do
|
|
41
41
|
context 'when FACEBOOK_PIXEL_ID environment variable is present' do
|
42
42
|
let(:env_variable) { 'FACEBOOK_PIXEL_ID' }
|
43
43
|
|
44
|
-
it '
|
44
|
+
it 'tracks "Purchase" event with product data' do
|
45
45
|
subject
|
46
46
|
expect(page).to track_analytics_event :facebook, 'purchase', ['track', 'Purchase', order.total, line_item.sku, line_item.quantity, order.number]
|
47
47
|
end
|
@@ -50,7 +50,7 @@ describe 'Checkout complete', type: :system do
|
|
50
50
|
context 'when PINTEREST_TAG_ID environment variable is present' do
|
51
51
|
let(:env_variable) { 'PINTEREST_TAG_ID' }
|
52
52
|
|
53
|
-
it '
|
53
|
+
it 'tracks "checkout" event with product data' do
|
54
54
|
subject
|
55
55
|
expect(page).to track_analytics_event :pinterest, 'purchase', ['track', 'checkout', order.total, line_item.sku, line_item.name, line_item.price]
|
56
56
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe 'Checkout initated', type: :system do
|
4
|
+
let!(:store) { create(:store) }
|
5
|
+
let!(:taxon) { create :taxon, name: 'MyTaxon' }
|
6
|
+
let!(:product) { create(:base_product, taxons: [taxon]) }
|
7
|
+
let(:order) { Spree::Order.last }
|
8
|
+
|
9
|
+
stub_authorization!
|
10
|
+
|
11
|
+
before do
|
12
|
+
stub_const 'ENV', ENV.to_h.merge(env_variable => 'XXX-YYYYY')
|
13
|
+
end
|
14
|
+
|
15
|
+
subject do
|
16
|
+
visit spree.product_path(product)
|
17
|
+
find('#add-to-cart-button').click
|
18
|
+
find('#checkout-link').click
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when GOOGLE_TAG_MANAGER_ID environment variable is present' do
|
22
|
+
let(:env_variable) { 'GOOGLE_TAG_MANAGER_ID' }
|
23
|
+
|
24
|
+
it 'tracks "InitiateCheckout" event with product data' do
|
25
|
+
skip
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when GOOGLE_ANALYTICS_ID environment variable is present' do
|
30
|
+
let(:env_variable) { 'GOOGLE_ANALYTICS_ID' }
|
31
|
+
|
32
|
+
it 'tracks "InitiateCheckout" event with product data' do
|
33
|
+
skip
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when FACEBOOK_PIXEL_ID environment variable is present' do
|
38
|
+
let(:env_variable) { 'FACEBOOK_PIXEL_ID' }
|
39
|
+
|
40
|
+
it 'tracks "InitiateCheckout" event with product data' do
|
41
|
+
subject
|
42
|
+
expect(page).to track_analytics_event :facebook, 'initiatecheckout', ['track', 'InitiateCheckout', order.total, order.currency, order.line_items.first.sku]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when PINTEREST_TAG_ID environment variable is present' do
|
47
|
+
let(:env_variable) { 'PINTEREST_TAG_ID' }
|
48
|
+
|
49
|
+
it 'tracks "checkout" event with product data' do
|
50
|
+
skip
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
describe "Product page", type: :system do
|
2
|
-
let!(:store) {
|
2
|
+
let!(:store) { create(:store) }
|
3
3
|
let(:store_seo_name) { 'My store SEO name' }
|
4
4
|
|
5
5
|
let!(:taxon) { create(:taxon, name: 'MyTaxon') }
|
@@ -97,6 +97,17 @@ describe "Product page", type: :system do
|
|
97
97
|
stub_const 'ENV', ENV.to_h.merge(env_variable => 'XXX-YYYYY')
|
98
98
|
end
|
99
99
|
|
100
|
+
context 'when FACEBOOK_PIXEL_ID environment variable is present' do
|
101
|
+
let(:env_variable) { 'FACEBOOK_PIXEL_ID' }
|
102
|
+
|
103
|
+
it 'tracks "ViewContent" event with product data' do
|
104
|
+
subject
|
105
|
+
expect(page).to track_analytics_event :facebook, 'viewcontent', [
|
106
|
+
'fbq', 'track', 'ViewContent', product.name, product.master.sku
|
107
|
+
]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
100
111
|
context 'when PINTEREST_TAG_ID environment variable is present' do
|
101
112
|
let(:env_variable) { 'PINTEREST_TAG_ID' }
|
102
113
|
|
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.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karma Creative
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|
@@ -337,6 +337,7 @@ files:
|
|
337
337
|
- app/assets/javascripts/spree/frontend/solidus_seo.js
|
338
338
|
- app/assets/stylesheets/spree/backend/solidus_seo.css
|
339
339
|
- app/assets/stylesheets/spree/frontend/solidus_seo.css
|
340
|
+
- app/decorators/controllers/spree/checkout_controller_decorator.rb
|
340
341
|
- app/decorators/controllers/spree/orders_controller_decorator.rb
|
341
342
|
- app/decorators/controllers/spree/store_controller_decorator.rb
|
342
343
|
- app/decorators/helpers/spree/core/controller_helpers/common_decorator.rb
|
@@ -360,6 +361,7 @@ files:
|
|
360
361
|
- lib/generators/solidus_seo/install/templates/insert_product_list_helper.html.erb.deface
|
361
362
|
- lib/generators/solidus_seo/install/templates/paperclip_optimizer.rb
|
362
363
|
- lib/generators/solidus_seo/install/templates/remove_original_title_tag.deface
|
364
|
+
- lib/generators/solidus_seo/install/templates/replace_flash_messages_helper.html.erb.deface
|
363
365
|
- lib/generators/solidus_seo/install/templates/replace_taxon_breadcrumbs_helper.html.erb.deface
|
364
366
|
- lib/solidus_seo.rb
|
365
367
|
- lib/solidus_seo/engine.rb
|
@@ -382,6 +384,7 @@ files:
|
|
382
384
|
- spec/examples.txt
|
383
385
|
- spec/features/add_to_cart_spec.rb
|
384
386
|
- spec/features/checkout_complete_spec.rb
|
387
|
+
- spec/features/checkout_initiated_spec.rb
|
385
388
|
- spec/features/homepage_spec.rb
|
386
389
|
- spec/features/product_page_spec.rb
|
387
390
|
- spec/features/taxon_page_spec.rb
|
@@ -392,7 +395,7 @@ homepage: https://github.com/karmakatahdin/solidus_seo
|
|
392
395
|
licenses:
|
393
396
|
- BSD-3-Clause
|
394
397
|
metadata: {}
|
395
|
-
post_install_message:
|
398
|
+
post_install_message:
|
396
399
|
rdoc_options: []
|
397
400
|
require_paths:
|
398
401
|
- lib
|
@@ -407,15 +410,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
407
410
|
- !ruby/object:Gem::Version
|
408
411
|
version: '0'
|
409
412
|
requirements: []
|
410
|
-
rubyforge_project:
|
413
|
+
rubyforge_project:
|
411
414
|
rubygems_version: 2.7.6.2
|
412
|
-
signing_key:
|
415
|
+
signing_key:
|
413
416
|
specification_version: 4
|
414
417
|
summary: Enhanced SEO in Solidus
|
415
418
|
test_files:
|
416
419
|
- spec/spec_helper.rb
|
417
420
|
- spec/examples.txt
|
418
421
|
- spec/features/checkout_complete_spec.rb
|
422
|
+
- spec/features/checkout_initiated_spec.rb
|
419
423
|
- spec/features/homepage_spec.rb
|
420
424
|
- spec/features/taxon_page_spec.rb
|
421
425
|
- spec/features/add_to_cart_spec.rb
|