jekyll-attendease 0.6.43.1 → 0.6.43.2

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: c74096b6b64ccfa195db812d2c030d07b8f29006
4
- data.tar.gz: 7267410e708972e3084d712ab0bc4e4d48bad516
3
+ metadata.gz: 36d0d817712d4126ee5f0676cd4144dcc5335beb
4
+ data.tar.gz: aec70c6a21e694d4f14d7ca85c94704f90354165
5
5
  SHA512:
6
- metadata.gz: 8bc0f506a978100b8ab493696b5b8b8391361b65eab24a7ff4588065c5895cdc7568eb4049999620c560d5d7f97c4f570936e8997c0e50dc76d831b2a07bf98a
7
- data.tar.gz: 796eaf09bc3e1a77662988889f518a24b3fb5bcdc750ee3429643a89787bdacd54f5df15f00098bf03b5f8ab399c1fc9b4ded2a7a272e5ebc06a13d5f975dd1e
6
+ metadata.gz: f2fc7ad5c50e674d603aae04aee3324b289b3b1eb38809cac940cf4e8ff25716ff103f5edb4314023563b223c921be147906f394efbf7862f64889021025c304
7
+ data.tar.gz: 5e2b83f716a76393cb9b97b846cf38c262546b188735edeff3777e4fe0c01ae8d3a5b3140d363a854c69883fa67943e7ce1b94326f5855baccbf0b56e0332b4d
@@ -21,5 +21,6 @@ Liquid::Template.register_tag('attendease_analytics_gtm_body', Jekyll::Attendeas
21
21
  Liquid::Template.register_tag('attendease_analytics_ga_gtag', Jekyll::AttendeasePlugin::AnalyticsGoogleAnalyticsGtagTag)
22
22
  Liquid::Template.register_tag('attendease_analytics_facebook', Jekyll::AttendeasePlugin::AnalyticsFacebookPixelTag)
23
23
  Liquid::Template.register_tag('attendease_analytics_linkedin', Jekyll::AttendeasePlugin::AnalyticsLinkedInTag)
24
+ Liquid::Template.register_tag('attendease_analytics_settings', Jekyll::AttendeasePlugin::AnalyticsSettingsTag)
24
25
 
25
26
  Liquid::Template.register_filter(Jekyll::AttendeasePlugin::Filters)
@@ -326,8 +326,6 @@ _EOT
326
326
  || analytics['googleAnalyticsTrackingId'].nil? \
327
327
  || analytics['googleAnalyticsTrackingId'].empty?
328
328
 
329
- return '' if analytics.nil? || !analytics['googleAnalyticsTrackingId']
330
-
331
329
  adwordsId = analytics['googleAnalyticsAdwordsId']
332
330
  script = <<_EOT
333
331
  <!-- Global Site Tag (gtag.js) - Google Analytics -->
@@ -379,7 +377,6 @@ _EOT
379
377
  site_settings = context.registers[:site].data['site_settings'].clone
380
378
  analytics = site_settings['analytics']
381
379
 
382
- return '' if analytics.nil? || !analytics['facebookPixelId']
383
380
  return '' if analytics.nil? \
384
381
  || analytics['facebookPixelId'].nil? \
385
382
  || analytics['facebookPixelId'].empty?
@@ -401,6 +398,29 @@ _EOT
401
398
  src="https://www.facebook.com/tr?id=#{analytics['facebookPixelId']}&ev=PageView&noscript=1"
402
399
  /></noscript>
403
400
  <!-- End Facebook Pixel Code -->
401
+ _EOT
402
+ script
403
+ end
404
+ end
405
+
406
+ class AnalyticsSettingsTag < Liquid::Tag
407
+ def render(context)
408
+ site_settings = context.registers[:site].data['site_settings'].clone
409
+ analytics = site_settings['analytics']
410
+
411
+ return '' if analytics.nil? \
412
+
413
+ # the id keys we want to expose
414
+ keys = %w[ googleAnalyticsTrackingId ]
415
+ analytic_ids = analytics.select { |k, v| keys.include?(k) }
416
+
417
+ script = <<_EOT
418
+ <!-- Global Analytics Settings -->
419
+ <script>
420
+ window.AnalyticsSettings = {
421
+ #{ analytic_ids.map { |k, v| " #{k}: #{v.to_json}" }.join(",\n")}
422
+ }
423
+ </script>
404
424
  _EOT
405
425
  script
406
426
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AttendeasePlugin
3
- VERSION = '0.6.43.1'
3
+ VERSION = '0.6.43.2'
4
4
  end
5
5
  end
@@ -150,6 +150,14 @@ RSpec.describe "Jekyll Attendease tags" do
150
150
  it { is_expected.to match(/Facebook Pixel Code/) }
151
151
  it { is_expected.to match(/foo/) }
152
152
  end
153
+
154
+ describe "{% attendease_analytics_settings %}" do
155
+ subject { cms_render("{% attendease_analytics_settings %}") }
156
+
157
+ it { is_expected.to match(/Global Analytics Settings/) }
158
+ it { is_expected.to match(/googleAnalyticsTrackingId: "foo"/) }
159
+ it { is_expected.to match(/window.AnalyticsSettings = /) }
160
+ end
153
161
  end
154
162
 
155
163
  def schedule_widget_data
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-attendease
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.43.1
4
+ version: 0.6.43.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wood
8
8
  - Patrick Gibson
9
9
  - Jamie Lubiner
10
10
  - Antoine Censi
11
+ - Adrian Jones
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2018-11-25 00:00:00.000000000 Z
15
+ date: 2018-11-28 00:00:00.000000000 Z
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
17
18
  name: httparty