jekyll-attendease 0.6.43.2 → 0.6.43.3

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: 36d0d817712d4126ee5f0676cd4144dcc5335beb
4
- data.tar.gz: aec70c6a21e694d4f14d7ca85c94704f90354165
3
+ metadata.gz: 1fd982ba5a7fab63d1dd6c4fedc02de729f5b22e
4
+ data.tar.gz: f40d85fcabf1092cfd65ef5e39812764c570002a
5
5
  SHA512:
6
- metadata.gz: f2fc7ad5c50e674d603aae04aee3324b289b3b1eb38809cac940cf4e8ff25716ff103f5edb4314023563b223c921be147906f394efbf7862f64889021025c304
7
- data.tar.gz: 5e2b83f716a76393cb9b97b846cf38c262546b188735edeff3777e4fe0c01ae8d3a5b3140d363a854c69883fa67943e7ce1b94326f5855baccbf0b56e0332b4d
6
+ metadata.gz: 9c484e974e21529b3cbc326b8af17fe10c236ee22746ae550a063f1eeeb44e22eb901d8e78c56f1096c1b4c6c88cbb032e1224cb4d8f826ed1bcd8fd6ee4477a
7
+ data.tar.gz: f5787c010552bef0e81779f2200db19e0a48f57a9060c49a9a2f09f5afcbeefdea17f9e567887d1b700bb9342bef8ab72a0fbf29259a1657011d9f16e90defc6
@@ -322,21 +322,22 @@ _EOT
322
322
  site_settings = context.registers[:site].data['site_settings'].clone
323
323
  analytics = site_settings['analytics']
324
324
 
325
- return '' if analytics.nil? \
326
- || analytics['googleAnalyticsTrackingId'].nil? \
327
- || analytics['googleAnalyticsTrackingId'].empty?
325
+ has_analytics_id = !analytics.nil? && !analytics['googleAnalyticsTrackingId'].nil? && !analytics['googleAnalyticsTrackingId'].empty?
326
+ has_adwords_id = !analytics.nil? && !analytics['googleAnalyticsAdwordsId'].nil? && !analytics['googleAnalyticsAdwordsId'].empty?
327
+ return '' if analytics.nil? || (!has_analytics_id && !has_adwords_id)
328
+
329
+ gtag_id = has_analytics_id ? analytics['googleAnalyticsTrackingId'] : analytics['googleAnalyticsAdwordsId']
328
330
 
329
- adwordsId = analytics['googleAnalyticsAdwordsId']
330
331
  script = <<_EOT
331
332
  <!-- Global Site Tag (gtag.js) - Google Analytics -->
332
- <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.data.site_settings.analytics.googleAnalyticsTrackingId }}"></script>
333
+ <script async src="https://www.googletagmanager.com/gtag/js?id=#{gtag_id}"></script>
333
334
  <script>
334
335
  window.dataLayer = window.dataLayer || [];
335
336
  function gtag(){dataLayer.push(arguments);}
336
337
  gtag('js', new Date());
337
338
 
338
- gtag('config', '#{analytics['googleAnalyticsTrackingId']}');
339
- #{ adwordsId ? "gtag('config', '#{adwordsId}');" : ''}
339
+ #{ has_analytics_id ? " gtag('config', '#{analytics['googleAnalyticsTrackingId']}');" : ''}
340
+ #{ has_adwords_id ? " gtag('config', '#{analytics['googleAnalyticsAdwordsId']}');" : ''}
340
341
  </script>
341
342
  _EOT
342
343
  script
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AttendeasePlugin
3
- VERSION = '0.6.43.2'
3
+ VERSION = '0.6.43.3'
4
4
  end
5
5
  end
@@ -134,7 +134,9 @@ RSpec.describe "Jekyll Attendease tags" do
134
134
  subject { cms_render("{% attendease_analytics_ga_gtag %}") }
135
135
 
136
136
  it { is_expected.to match(/Global Site Tag \(gtag.js\)/) }
137
- it { is_expected.to match(/foo/) }
137
+ it { is_expected.to match(/js\?id=google_analytics/) }
138
+ it { is_expected.to match(/gtag\('config'\, 'google_analytics'\)/) }
139
+ it { is_expected.to match(/gtag\('config'\, 'adwords'\)/) }
138
140
  end
139
141
 
140
142
  describe "{% attendease_analytics_linked_in %}" do
@@ -155,7 +157,7 @@ RSpec.describe "Jekyll Attendease tags" do
155
157
  subject { cms_render("{% attendease_analytics_settings %}") }
156
158
 
157
159
  it { is_expected.to match(/Global Analytics Settings/) }
158
- it { is_expected.to match(/googleAnalyticsTrackingId: "foo"/) }
160
+ it { is_expected.to match(/googleAnalyticsTrackingId: "google_analytics"/) }
159
161
  it { is_expected.to match(/window.AnalyticsSettings = /) }
160
162
  end
161
163
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-attendease
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.43.2
4
+ version: 0.6.43.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wood
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2018-11-28 00:00:00.000000000 Z
15
+ date: 2018-11-30 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: httparty