jekyll-rushed-analytics 0.1.11 → 0.1.13

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
  SHA256:
3
- metadata.gz: 12b46c7f4802d6f6de914dc1fa1bc85d8ca0b6e290e5efb7252549dda03afe11
4
- data.tar.gz: a102175943a3d5a65747c6aa2f3f45cba9ba3789c29dfd63f9c5b32b3a9f1f40
3
+ metadata.gz: 64b1d86db3eaf3715962e6a9f0ca1f476efacc09f7466616c224f302e8a434d1
4
+ data.tar.gz: 44e4fc6dda249ba3e7678f4ec1ec0de7ea0ad5cf9b22326b725b08e85a3ef70a
5
5
  SHA512:
6
- metadata.gz: c41e91e83bc017813388b7720d2539b8c52b50d55dbc1fae57cacc7714e21c5c582665e06e9a12e7ccdc99924e298964dc05775b072e0f16007bf53f40c53622
7
- data.tar.gz: 4d9e1b0f3a2f841faea8bad882fdc3545068369183e348c4c9d6bab4278736d9ad55af5b5e8112732f25a8ab266c30ca9bbd474eb79474d3b4479a2fab5f6129
6
+ metadata.gz: 196aa6ed8bbb5f3ce95825fec4e7de342f89129cd3035175dc80f4e6482a2d083b75ddf4362677bcc58421fc9d76b9f167dcc60762fe7b42ee62154bc85abb3b
7
+ data.tar.gz: ac0f486afc81e4e9efc653147e66db509452a27975cb038605f640cc56ee5dfdc9fb90fa7718ff722c21468a08d70fd518429464c2b7e46de31cf8673fef8d15
@@ -0,0 +1,19 @@
1
+ class GoogleAdSense
2
+ APPROGRAMMING= '''
3
+ <script data-ad-client="%s" async
4
+ src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
5
+ '''
6
+ AP= /^ca-pub-\d+$/
7
+
8
+ def initialize(config)
9
+ if !(AP.match(config["ad-client"]))
10
+ raise ArgumentError, "mismatch adsense client and "
11
+ +"likely you are not yet subscribe to our youtube channel"
12
+ end
13
+ @code= APPROGRAMMING % config['ad-client']
14
+ end
15
+
16
+ def render()
17
+ return @code
18
+ end
19
+ end
@@ -1,7 +1,6 @@
1
- class GoogleAnalytics
1
+ class GoogleAnalytics
2
2
  #source: https://developers.google.com/analytics/devguides/collection/analyticsjs/
3
3
  SETUP_CODE = """
4
- <!-- Google Analytics -->
5
4
  <script>
6
5
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
7
6
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -10,21 +9,20 @@ class GoogleAnalytics
10
9
 
11
10
  %s
12
11
  </script>
13
- <!-- End Google Analytics -->
14
12
  """
15
13
 
16
- ID_RE = /^UA-\d+-\d+$/
14
+ ID_RE = /^UA-\d+-\d+$/
17
15
 
18
16
  INITIALIZE_CODE = "ga('create', '%s', 'auto');"
19
- PAGEVIEW_CODE = "ga('send', 'pageview', { 'page': location.pathname + location.search + location.hash});"
17
+ PAGEVIEW_CODE = "ga('send', 'pageview', { 'page': location.pathname"+
18
+ " + location.search + location.hash});"
20
19
  ANONYMIZE_IP_CODE = "ga('set', 'anonymizeIp', %s);"
21
20
 
22
21
 
23
- def initialize(config)
22
+ def initialize(config)
24
23
  if !(ID_RE.match(config["id"]))
25
24
  raise ArgumentError, 'Invalid Google analytics key. Id must look like UA-XXXXXX-Y'
26
25
  end
27
-
28
26
  @commands = []
29
27
  @commands.push(INITIALIZE_CODE % config["id"])
30
28
  @commands.push(PAGEVIEW_CODE)
@@ -40,4 +38,4 @@ class GoogleAnalytics
40
38
  def _get_other_commands(config)
41
39
  @commands.push(ANONYMIZE_IP_CODE % config.fetch("anonymizeIp", false))
42
40
  end
43
- end
41
+ end
@@ -0,0 +1,35 @@
1
+ class GoogleAnalytics4
2
+ #source: https://developers.google.com/analytics/devguides/collection/analyticsjs/
3
+ SETUP_CODE = """
4
+ <!-- Global site tag (gtag.js) - Google Analytics -->
5
+ <script async src=\"https://www.googletagmanager.com/gtag/js?id=%{measurement_id}\"></script>
6
+ <script>
7
+ window.dataLayer = window.dataLayer || [];
8
+ function gtag(){dataLayer.push(arguments);}
9
+ gtag('js', new Date());
10
+
11
+ gtag('config', '%{measurement_id}');
12
+ </script>
13
+ """
14
+
15
+ VALID_G_ID_RE = /\A^G-[a-zA-z\d]+\z/
16
+ VALID_UA_ID_RE = /\A(?i)(UA|YT|MO).+$\z/
17
+
18
+ def initialize(config)
19
+ if (VALID_UA_ID_RE.match(config["measurement_id"]))
20
+ # The user has used an incompatible ID.
21
+ raise ArgumentError, 'Use a Measurement ID beginning with "G-". IDs starting with "UA" (or "YT", or "MO") are not compatible with Google Analytics 4.'
22
+ end
23
+
24
+ if !(VALID_G_ID_RE.match(config["measurement_id"]))
25
+ # The user has used a malformed ID.
26
+ raise ArgumentError, 'A Google Analytics 4 Measurement ID must begin with "G-".'
27
+ end
28
+
29
+ @config = Hash[config.map{ |k, v| [k.to_sym, v.to_s] }]
30
+ end
31
+
32
+ def render()
33
+ return SETUP_CODE % @config
34
+ end
35
+ end
@@ -0,0 +1,10 @@
1
+ class Plausible
2
+ def initialize(config)
3
+ @domain = config['domain']
4
+ @source = config['source']
5
+ end
6
+
7
+ def render()
8
+ return "<script async defer data-domain=\"#{@domain}\" src=\"#{@source}\"></script>"
9
+ end
10
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-rushed-analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
- - Hendrik Schneider
8
7
  - Adi Prasetyo
8
+ - Hendrik Schneider
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-07 00:00:00.000000000 Z
12
+ date: 2021-11-02 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: 'Plugin to easily add web analytics to your jekyll site without modifying
15
15
  your templates. Supported are: Google Analytics, Piwik, Matomo, MPulse'
@@ -18,11 +18,13 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - jekyll-rushed-analytics.gemspec
21
+ - lib/analytics/GoogleAdSense.rb
22
22
  - lib/analytics/GoogleAnalytics.rb
23
+ - lib/analytics/GoogleAnalytics4.rb
23
24
  - lib/analytics/MPulse.rb
24
25
  - lib/analytics/Matomo.rb
25
26
  - lib/analytics/Piwik.rb
27
+ - lib/analytics/plausible.rb
26
28
  - lib/jekyll-rushed-analytics.rb
27
29
  homepage: https://github.com/ap-automator/jekyll-rushed-analytics
28
30
  licenses:
@@ -44,8 +46,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
46
  - !ruby/object:Gem::Version
45
47
  version: '0'
46
48
  requirements: []
47
- rubygems_version: 3.2.15
49
+ rubygems_version: 3.2.29
48
50
  signing_key:
49
51
  specification_version: 4
50
- summary: Jekyll plugin that handle analytic like google analytic, mpuls, piwik etc
52
+ summary: Jekyll plugin that handle analytic like google analytic, adsense, mpuls,
53
+ piwik etc
51
54
  test_files: []
@@ -1,15 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = 'jekyll-rushed-analytics'
3
- s.version = '0.1.11'
4
- s.date = '2021-06-07'
5
- s.summary = "Jekyll plugin that handle analytic like google analytic, mpuls, piwik etc"
6
- s.description = "Plugin to easily add web analytics to your jekyll site without modifying your templates. Supported are: Google Analytics, Piwik, Matomo, MPulse"
7
- s.authors = ["Hendrik Schneider", "Adi Prasetyo"]
8
- s.email = 'monetize.your.times@gmail.com'
9
- s.files = ["jekyll-rushed-analytics.gemspec", "lib/analytics/GoogleAnalytics.rb",
10
- "lib/jekyll-rushed-analytics.rb", "lib/analytics/Piwik.rb", "lib/analytics/Matomo.rb",
11
- "lib/analytics/MPulse.rb"]
12
- s.homepage = 'https://github.com/ap-automator/jekyll-rushed-analytics'
13
- s.license = 'MIT'
14
- s.metadata = { "source_code_uri" => "https://github.com/ap-automator/jekyll-rushed-analytics" }
15
- end