spree_gtm 0.0.18 → 0.0.19
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d389c929db476554208a92e885b42f92d0641e5
|
4
|
+
data.tar.gz: 2b69982eda13e74b1ccf392f72b359b39bc95f13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b854a1f76bffcd3fb174ffcffe58c014f899bfd6face06645714523c1f964a6b044bfc2cf02fa944bdfbdf3f2b7f6a052d75cc4d061210845a0d948e6cd0905
|
7
|
+
data.tar.gz: 0681127c8da864b8f2d30904556e3ebc250adf50151f1d8c29e31a8b9f92b6367235ef617aadf3455120e161562813c8e120a3f2b5d8de15f60ca813d3af40f8
|
@@ -16,9 +16,19 @@
|
|
16
16
|
dataLayer.push({'transactionEmail': '<%= @order.email %>'});
|
17
17
|
<% end %>
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
<% if current_page?('/cart') %>
|
20
|
+
dataLayer.push({'cart': [
|
21
|
+
<%=raw @order.line_items.map { |line_item| "{ 'sku': '#{h line_item.variant.sku}',
|
22
|
+
'name': '#{h line_item.variant.product.name}',
|
23
|
+
'category': '',
|
24
|
+
'price': #{h line_item.price},
|
25
|
+
'quantity': #{h line_item.quantity}}" } .join(",") %>
|
26
|
+
]
|
27
|
+
});
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
<% if current_page?('/products') %>
|
31
|
+
dataLayer.push({'products': [
|
22
32
|
'name': '<%= @product.name %>',
|
23
33
|
'sku': '<%= @product.sku %>',
|
24
34
|
'price': '<%= @product.price %>'
|
@@ -30,7 +40,7 @@
|
|
30
40
|
dataLayer.push({'userid': '<%= @order.user.id %>'});
|
31
41
|
<% end %>
|
32
42
|
|
33
|
-
<% if
|
43
|
+
<% if current_page?('/order') %>
|
34
44
|
|
35
45
|
dataLayer.push({
|
36
46
|
'transactionId': '<%= @order.number %>',
|
@@ -1,20 +1,45 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
3
|
+
describe "Tag implementation on the pages" do
|
4
|
+
|
5
|
+
context "gtm id implement in tag " do
|
6
|
+
it "should render tag with gtm id" do
|
7
|
+
fill_in_gtm_id
|
8
|
+
visit ('/')
|
9
|
+
page.all('body script', visible: false).each do |script|
|
10
|
+
script.text == "dataLayer, bag"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
context "tag present on cart page " do
|
17
|
+
it "should render tag" do
|
18
|
+
fill_in_gtm_id
|
19
|
+
visit ('/cart')
|
20
|
+
page.all('body script', visible: false).each do |script|
|
21
|
+
script.text == "dataLayer, cart"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "tag present on product page " do
|
27
|
+
it "should render tag on product page" do
|
28
|
+
fill_in_gtm_id
|
29
|
+
visit ('/products')
|
30
|
+
page.all('body script', visible: false).each do |script|
|
31
|
+
script.text == "dataLayer, product"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "tag present on order page " do
|
37
|
+
it "should render tag on order page" do
|
38
|
+
fill_in_gtm_id
|
39
|
+
visit ('/order')
|
40
|
+
page.all('body script', visible: false).each do |script|
|
41
|
+
script.text == "dataLayer, order"
|
42
|
+
end
|
17
43
|
end
|
18
44
|
end
|
19
|
-
end
|
20
45
|
end
|
@@ -6,4 +6,15 @@ module AuthenticationHelpers
|
|
6
6
|
click_button "Login"
|
7
7
|
page.should have_content("Logged in successfully")
|
8
8
|
end
|
9
|
+
|
10
|
+
def fill_in_gtm_id
|
11
|
+
user = create(:admin_user, :email => "test@example.com", :password => "spree123")
|
12
|
+
sign_in_as!(user)
|
13
|
+
visit spree.admin_path
|
14
|
+
click_link "Configurations"
|
15
|
+
click_link "Google Tag Manager"
|
16
|
+
fill_in('Gtm accountid', :with => 'bag')
|
17
|
+
click_button "Save"
|
18
|
+
page.should have_content("Gtm has been successfully")
|
19
|
+
end
|
9
20
|
end
|
data/spree_gtm.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_gtm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanislav O. Pogrebnyak
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-12-
|
12
|
+
date: 2016-12-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_core
|