effective_pages 3.4.10 → 3.4.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: d47d3c8c168eb5294d42246a5c16c27f37d497511b5daad694b8d3b5327042a6
4
- data.tar.gz: 3cbd1020565a4a1342674b637aae21dc24c6437d793f804c43a67d711f38f8e7
3
+ metadata.gz: 13324875d7eed671ec3197d639c43aad04f24751261d2c6f2b04e3d183a95c1b
4
+ data.tar.gz: 707bc904234f37b21b88ea6ed3ba5d58fb4d3f2978012837c66a3dfbc2072b65
5
5
  SHA512:
6
- metadata.gz: b0d398a5d2f072fbf27ba6d31fad76703182f8d09ef825c2f0fb7dacf01a448f480bd565011009fd62dde8ad15e50a51c581e7061c45e20bbfe56482eb88eedd
7
- data.tar.gz: d7b2a8f930af2e52152669681f5329e78ce4dc39d61376f2e4d8b47834e80b60349c6b156ec92d01d736eef11973910b748ca66d063fb5b0dd18eafd0da5cd3a
6
+ metadata.gz: 1431e378f871945a3ee1be9a87c3eea61b1b2f03724257df9f5d9feba7a1232f2ab5bfb7a66038fec9c6342b7e44919ad67e35f9be899f1547ba5783174e2fff
7
+ data.tar.gz: 6259af43261f9822804dea61faffedb17adf53a967078946e6465800bd8b7771224b29789bba8dba75c93fa3e1cedf7e6dbdb050ad63af785b21cc090e20686c
data/README.md CHANGED
@@ -159,14 +159,20 @@ This helper is entirely optional and in no way required for effective_pages to w
159
159
 
160
160
  ### Google Analytics GTag Script Helper
161
161
 
162
- Another optional helper. Add the following just after your `<body>` tag:
162
+ Only works with Turbolinks.
163
+
164
+ Include the effective_pages.js javascript file in your asset pipeline.
163
165
 
164
- ```haml
165
- %body
166
- = effective_pages_google_analytics
166
+ ```
167
+ //= require effective_pages
167
168
  ```
168
169
 
169
- This will render the google analytics scripts when running in production mode.
170
+ Add the following include your `<head>` tag:
171
+
172
+ ```haml
173
+ %head
174
+ = effective_pages_google_analytics
175
+ ```
170
176
 
171
177
  Set the GA4 code in your `config/initializers/effective_pages.rb` as so:
172
178
 
@@ -174,6 +180,8 @@ Set the GA4 code in your `config/initializers/effective_pages.rb` as so:
174
180
  config.google_analytics_code = 'G-1234567890'
175
181
  ```
176
182
 
183
+ This will render the google analytics script tags when running in production mode.
184
+
177
185
  ### Permissions
178
186
 
179
187
  When creating a Page, if you've also installed the [effective_roles](https://github.com/code-and-effect/effective_roles) gem, you will be able to configure user access on a per-page basis.
@@ -0,0 +1 @@
1
+ //= link_directory ../javascripts .js
@@ -0,0 +1,13 @@
1
+ // Add Google Analytics Code
2
+ // Supports Turbolinks and Turbo
3
+ document.addEventListener('turbolinks:load', function(event){
4
+ if(typeof(gtag) != 'function') { return }
5
+
6
+ var code = $('head').find('script[data-gtag-code]').first().data('gtag-code');
7
+ if(typeof(code) == undefined) { return }
8
+
9
+ gtag('config', code, {
10
+ 'page_title' : document.title,
11
+ 'page_path': location.href.replace(location.origin, "")
12
+ });
13
+ })
@@ -0,0 +1 @@
1
+ //= require_tree ./effective_pages
@@ -1,9 +1,7 @@
1
1
  <!-- Google tag (gtag.js) -->
2
2
  <script async src="https://www.googletagmanager.com/gtag/js?id=<%= code %>"></script>
3
- <script>
3
+ <script data-gtag-code="<%= code %>">
4
4
  window.dataLayer = window.dataLayer || [];
5
5
  function gtag(){dataLayer.push(arguments);}
6
6
  gtag('js', new Date());
7
-
8
- gtag('config', '<%= code %>');
9
7
  </script>
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '3.4.10'.freeze
2
+ VERSION = '3.4.11'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.10
4
+ version: 3.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
@@ -75,6 +75,9 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - MIT-LICENSE
77
77
  - README.md
78
+ - app/assets/config/effective_pages_manifest.js
79
+ - app/assets/javascripts/effective_pages.js
80
+ - app/assets/javascripts/effective_pages/google_analytics.js
78
81
  - app/controllers/admin/carousel_items_controller.rb
79
82
  - app/controllers/admin/menus_controller.rb
80
83
  - app/controllers/admin/page_banners_controller.rb