mirror of https://github.com/luizdepra/hugo-coder.git

YUJI
15.38.2020 dbe21a7fdf0d5556de5b2f2f8bdf4f64228ca241
Add support of Cloudflare Web Analytics (#492)

* Add support of Cloudflare Web Analytics

* Update exampleSite/config.toml

Co-authored-by: Luiz F. A. de Prá <luizdepra@users.noreply.github.com>

Co-authored-by: Luiz F. A. de Prá <luizdepra@users.noreply.github.com>
1 files added
3 files modified
19 ■■■■■ changed files
exampleSite/config.toml 4 ●●●● patch | view | raw | blame | history
layouts/_default/baseof.html 4 ●●●● patch | view | raw | blame | history
layouts/partials/analytics/cloudflare.html 4 ●●●● patch | view | raw | blame | history
stackbit.yaml 7 ●●●●● patch | view | raw | blame | history
exampleSite/config.toml
@@ -76,6 +76,10 @@
[params.goatCounter]
    code = "code"
# If you want to use Cloudflare Web Analytics(https://cloudflare.com) for analytics, add this section
[params.cloudflare]
    token = "token"
[taxonomies]
  category = "categories"
  series = "series"
layouts/_default/baseof.html
@@ -139,6 +139,10 @@
    {{ if and .Site.Params.goatCounter .Site.Params.goatCounter.code }}
      {{- partial "analytics/goatcounter" . -}}
    {{ end }}
    {{ if and .Site.Params.cloudflare .Site.Params.cloudflare.token }}
      {{- partial "analytics/cloudflare" . -}}
    {{ end }}
  </body>
</html>
layouts/partials/analytics/cloudflare.html
New file
@@ -0,0 +1,4 @@
<!-- Cloudflare Web Analytics -->
<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
        data-cf-beacon='{"token": "{{ $.Site.Params.cloudflare.token }}"}'></script>
<!-- End Cloudflare Web Analytics -->
stackbit.yaml
@@ -137,6 +137,13 @@
              - type: string
                name: code
                label: URL for Goat Counter
          - type: object
            name: cloudflare
            label:  Cloudflare Web Analytics (optional)
            fields:
              - type: string
                name: token
                label: token for Cloudflare Web Analytics
      - type: object
        name: languages
        fields: