al_analytics 1.0.0 → 1.0.2

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +23 -22
  4. data/lib/al_analytics.rb +21 -0
  5. metadata +10 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 620c4b0091ae81ab3e7791776ba9b09066d5b0bd2a36eaceed18363705ad19a2
4
- data.tar.gz: c0541e05903f8b1d59572e7599b8f43f3837a13d618436f86d2fe5bbd70f3daa
3
+ metadata.gz: eb0f197fe046cfdc04d3599054b64d7695d80231c98a7272f3e8eee79d3ed4ee
4
+ data.tar.gz: d1f64696a9fde0cb40afc73982954fc06d2300f1cc87edeeb811edd57c0fb517
5
5
  SHA512:
6
- metadata.gz: ba6599a3714d90fe38e17909e60b5537c6cd230e762102e0775b0f908547c6a514fa7ad61f1f7bef6925ba950695cb13e72d481bd0135e56dcca27d4e8b7a200
7
- data.tar.gz: f5a76e7f6874179885ca87c9129ab58a9a0631289dfcd4f4f2129ba83ec47eba080fb071b11b72a4162b9d98907c3ce47d66322bfb0920d471fe03fabcec8bb0
6
+ metadata.gz: c8a55f8ec4527be4c010f20a3ca02a837cad2a4207528bd5624d6a50ead2162f9c0237c4f92c3cea7418273b4df3b87687e9e6ea7a75d2f895155ac79ecdf5fb
7
+ data.tar.gz: 2b7804a1748e47d54436f87a9cc1c7d4a57b07190706c495e57c18c129a56db2ac9bbdb86a41db9a91924fa3669a2c078a8f0b017ed768f38c8db07e4f95c378
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.2 - 2026-07-29
4
+
5
+ - Added support for Cloudflare Web Analytics via `cloudflare_analytics` (token) and `enable_cloudflare_analytics` (flag). The beacon is only emitted when a token is present, so an unset token renders nothing rather than a beacon tag with an empty `data-cf-beacon` token. As with the other token-bearing providers, the flag defaults to on when a token is set and `false` turns the provider off explicitly, the legacy `analytics.cloudflare` key is still honored, and `enable_cookie_consent` adds the `type="text/plain" data-category="analytics"` attributes so the script only runs after consent.
6
+
7
+ ## 1.0.1 - 2026-07-27
8
+
9
+ - Added support for Simple Analytics via `enable_simple_analytics`. The provider has no site key, so it is controlled by the flag alone and honors `enable_cookie_consent` like every other provider.
10
+
3
11
  ## 0.1.1 - 2026-02-07
4
12
 
5
13
  - Fixed a Liquid compatibility bug by renaming the internal `blank?` helper to avoid conflict with Liquid parser internals.
data/README.md CHANGED
@@ -1,38 +1,30 @@
1
- # Al-Analytics
1
+ # al-analytics
2
2
 
3
- A Jekyll plugin that provides integrations with various analytics services for al-folio sites.
3
+ `al_analytics` provides analytics integrations for `al-folio` v1.x and compatible Jekyll sites.
4
4
 
5
- ## Supported Analytics Services
5
+ ## Supported providers
6
6
 
7
7
  - Google Analytics
8
8
  - Cronitor Analytics
9
9
  - Pirsch Analytics
10
10
  - OpenPanel Analytics
11
+ - Cloudflare Web Analytics
12
+ - Simple Analytics
11
13
 
12
14
  ## Installation
13
15
 
14
- Add this line to your Jekyll site's Gemfile:
15
-
16
16
  ```ruby
17
17
  gem 'al_analytics'
18
18
  ```
19
19
 
20
- And then execute:
21
-
22
- ```bash
23
- $ bundle install
24
- ```
25
-
26
- ## Usage
27
-
28
- 1. Add the plugin to your site's `_config.yml`:
29
-
30
20
  ```yaml
31
21
  plugins:
32
22
  - al_analytics
33
23
  ```
34
24
 
35
- 2. Configure your analytics services in `_config.yml`:
25
+ ## Usage
26
+
27
+ Configure analytics in `_config.yml`:
36
28
 
37
29
  ```yaml
38
30
  enable_cookie_consent: false
@@ -48,20 +40,29 @@ pirsch_analytics: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
48
40
 
49
41
  enable_openpanel_analytics: false
50
42
  openpanel_analytics: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
51
- ```
52
43
 
53
- The plugin also supports the legacy `analytics:` hash used by earlier releases.
44
+ # Cloudflare Web Analytics. The token is the value Cloudflare shows in the
45
+ # `data-cf-beacon` snippet; without it nothing is rendered.
46
+ enable_cloudflare_analytics: false
47
+ cloudflare_analytics: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
54
48
 
55
- 3. Add the analytics tag to your layout file (e.g., `_layouts/default.html`):
49
+ # Simple Analytics identifies your site by domain, so there is no key to set.
50
+ enable_simple_analytics: false
51
+ ```
52
+
53
+ Render scripts in your layout:
56
54
 
57
55
  ```liquid
58
56
  {% al_analytics_scripts %}
59
57
  ```
60
58
 
61
- ## Development
59
+ Legacy `analytics:` hash configuration is still supported.
60
+
61
+ ## Ecosystem context
62
62
 
63
- After checking out the repo, run `bundle install` to install dependencies.
63
+ - Starter wiring happens in `al-folio` (`Gemfile` + `_config.yml`).
64
+ - Consent/runtime coordination can be combined with `al_cookie`.
64
65
 
65
66
  ## Contributing
66
67
 
67
- Bug reports and pull requests are welcome on GitHub.
68
+ Provider/runtime changes belong here. Starter-only docs/demo updates belong in `al-folio`.
data/lib/al_analytics.rb CHANGED
@@ -68,6 +68,20 @@ module AlAnalytics
68
68
  HTML
69
69
  end
70
70
 
71
+ cloudflare_token = analytics_value(site, "cloudflare_analytics", "cloudflare")
72
+ if enabled?(site, "enable_cloudflare_analytics", cloudflare_token)
73
+ output << <<~HTML
74
+ <!-- Cloudflare Web Analytics -->
75
+ <script#{cookie_attrs} defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"token": "#{cloudflare_token}"}'></script>
76
+ HTML
77
+ end
78
+
79
+ if flag_enabled?(site, "enable_simple_analytics")
80
+ output << <<~HTML
81
+ <script#{cookie_attrs} async src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
82
+ HTML
83
+ end
84
+
71
85
  output.join("\n")
72
86
  end
73
87
 
@@ -87,6 +101,13 @@ module AlAnalytics
87
101
  legacy_config[legacy_key]
88
102
  end
89
103
 
104
+ # Simple Analytics identifies a site by its domain rather than by an
105
+ # embedded key, so there is no identifier to fall back on: the provider is
106
+ # controlled by its enable flag alone and stays off unless it is set.
107
+ def flag_enabled?(site, flag_key)
108
+ !!site.config[flag_key]
109
+ end
110
+
90
111
  def enabled?(site, flag_key, value)
91
112
  return false if value_blank?(value)
92
113
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: al_analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - al-org
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-16 00:00:00.000000000 Z
11
+ date: 2026-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '2.0'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: '3.0'
62
+ version: '5.0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: '2.0'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: '3.0'
72
+ version: '5.0'
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: rake
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -85,7 +85,8 @@ dependencies:
85
85
  - !ruby/object:Gem::Version
86
86
  version: '13.0'
87
87
  description: Jekyll plugin extracted from al-folio that renders Google Analytics,
88
- Cronitor RUM, Pirsch, and OpenPanel scripts with optional cookie-consent attributes.
88
+ Cronitor RUM, Pirsch, OpenPanel, Cloudflare Web Analytics, and Simple Analytics
89
+ scripts with optional cookie-consent attributes.
89
90
  email:
90
91
  - dev@al-org.dev
91
92
  executables: []
@@ -103,7 +104,7 @@ metadata:
103
104
  allowed_push_host: https://rubygems.org
104
105
  homepage_uri: https://github.com/al-org-dev/al-analytics
105
106
  source_code_uri: https://github.com/al-org-dev/al-analytics
106
- post_install_message:
107
+ post_install_message:
107
108
  rdoc_options: []
108
109
  require_paths:
109
110
  - lib
@@ -118,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  - !ruby/object:Gem::Version
119
120
  version: '0'
120
121
  requirements: []
121
- rubygems_version: 3.0.3.1
122
- signing_key:
122
+ rubygems_version: 3.5.22
123
+ signing_key:
123
124
  specification_version: 4
124
125
  summary: Analytics integration tags for al-folio Jekyll sites
125
126
  test_files: []