spree_gtm 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cc85621d1a8079ac2f51a05634f3766c3246392
4
- data.tar.gz: 30d6a8f5b40366c39ddb62c88846608ec3b99d1a
3
+ metadata.gz: 7168e31b5ff42083d503f48cd047c83263948e8e
4
+ data.tar.gz: dc4687cdc2b1c5fd9971b15083095856fe3d4c3a
5
5
  SHA512:
6
- metadata.gz: 2a3e144fcce4b2459c5b28a9efaabc917d5a70105b85914c1bd891dbcb6aeb8ab6ee58941d5eb03459f53ac95020c0c9ae133748a03ac1e7fee511f34513d19b
7
- data.tar.gz: 8824943ea8d3f3fbe1728f70be9f260a0e2870979dcd0c4bf7eaf8f4b634c24680ebe7dc33fa49b983f2a383083d4ce1e641dba1a46288bab8feae2c7e627499
6
+ metadata.gz: 6753e5d4a0bf2ee10ff2236f998e7a01c3c58f8222ee3f441e0dcd0722dba399e9bbb16101d822728501cf05777d74a367421bb1e3c38fd011b76efa286f2987
7
+ data.tar.gz: 9c86af5ddb47c489f151ef04897d4eb9d08366c1639c6e201b6572f21de42aefde8c935244fa3e6092c0a12ab3d0e98471134af2429e7c85887c55e231f002dc
@@ -1,9 +1,12 @@
1
1
  class Spree::Gtm < ActiveRecord::Base
2
2
  validates :gtm_accountid, presence: true
3
3
 
4
+ def self.activated?
5
+ first.present?
6
+ end
4
7
 
5
8
  def self.gtm_accountid
6
- first.gtm_accountid
7
- end
9
+ first.gtm_accountid
10
+ end
8
11
 
9
12
  end
@@ -1,7 +1,9 @@
1
- <!-- Google Tag Manager (noscript) -->
2
- <noscript>
3
- <iframe src="//www.googletagmanager.com/ns.html?id=<%= Spree::Gtm.gtm_accountid %>"
4
- height="0" width="0" style="display:none;visibility:hidden">
5
- </iframe>
6
- </noscript>
7
- <!-- End Google Tag Manager (noscript) -->
1
+ <% if Spree::Gtm.activated? %>
2
+ <!-- Google Tag Manager (noscript) -->
3
+ <noscript>
4
+ <iframe src="//www.googletagmanager.com/ns.html?id=<%= Spree::Gtm.gtm_accountid %>"
5
+ height="0" width="0" style="display:none;visibility:hidden">
6
+ </iframe>
7
+ </noscript>
8
+ <!-- End Google Tag Manager (noscript) -->
9
+ <% end %>
@@ -1,10 +1,12 @@
1
- <!-- Google Tag Manager -->
1
+ <% if Spree::Gtm.activated? %>
2
+ <!-- Google Tag Manager -->
2
3
 
3
- <script>
4
- (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
5
- new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
6
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
7
- 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
8
- })(window,document,'script','dataLayer','<%= Spree::Gtm.gtm_accountid %>');
9
- </script>
10
- <!-- End Google Tag Manager -->
4
+ <script>
5
+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
6
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
7
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
8
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
9
+ })(window,document,'script','dataLayer','<%= Spree::Gtm.gtm_accountid %>');
10
+ </script>
11
+ <!-- End Google Tag Manager -->
12
+ <% end %>
data/spree_gtm.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'spree_gtm'
5
- s.version = '0.0.3'
5
+ s.version = '0.0.4'
6
6
  s.summary = 'some summary here'
7
7
  s.description = 'some gem description here'
8
8
  s.required_ruby_version = '>= 2.1.0'
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav O. Pogrebnyak