Skip to content

Commit

Permalink
Extract analytics tools into a seprate gem plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
alshedivat committed Jan 20, 2025
1 parent f116356 commit 0b49426
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 55 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ end

# Gems for al-folio plugins
group :al_folio_plugins do
gem 'al_analytics', :git => 'https://github.com/al-org-dev/al-analytics.git'
gem 'al_citations', :git => 'https://github.com/al-org-dev/al-citations.git'
gem 'al_ext_posts', :git => 'https://github.com/al-org-dev/al-ext-posts.git'
end
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ GIT
jekyll (>= 0.10.0)
terser (>= 1.0.0)

GIT
remote: https://github.com/al-org-dev/al-analytics.git
revision: a9c7821b0a3639ed3f1cc8a8cdcaabfbb4f64f5d
specs:
al_analytics (0.1.0)
jekyll (>= 3.0)
liquid (>= 4.0)

GIT
remote: https://github.com/al-org-dev/al-citations.git
revision: d6dd73152f8ceafe475f0f0ad5c846167c006e4f
Expand Down Expand Up @@ -288,6 +296,7 @@ PLATFORMS
x86_64-linux-musl

DEPENDENCIES
al_analytics!
al_citations!
al_ext_posts!
classifier-reborn
Expand Down
18 changes: 8 additions & 10 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ og_image: # The site-wide (default for all links) Open Graph preview image
# Analytics and search engine verification
# -----------------------------------------------------------------------------

# For Google Analytics, see https://support.google.com/analytics/answer/10447272?hl=en&ref_topic=14088998&sjid=5129943941510317771-SA#zippy=%2Cgoogle-sites
# and follow the instructions for Google Sites. You will need to create a Google Analytics property and copy the Google tag ID.
google_analytics: # your Google Analytics measurement ID (format: G-XXXXXXXXXX)
cronitor_analytics: # cronitor RUM analytics site ID (format: XXXXXXXXX)
pirsch_analytics: # your Pirsch analytics site ID (length 32 characters)
openpanel_analytics: # your Openpanel analytics client ID (format: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)
analytics:
# For Google Analytics, see https://support.google.com/analytics/answer/10447272?hl=en&ref_topic=14088998&sjid=5129943941510317771-SA#zippy=%2Cgoogle-sites
# and follow the instructions for Google Sites. You will need to create a Google Analytics property and copy the Google tag ID.
google: # your Google Analytics measurement ID (format: G-XXXXXXXXXX)
cronitor: # cronitor RUM analytics site ID (format: XXXXXXXXX)
pirsch: # your Pirsch analytics site ID (length 32 characters)
openpanel: # your Openpanel analytics client ID (format: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)

# For Google Search Console, see https://support.google.com/webmasters/answer/9008080?hl=en#meta_tag_verification&zippy=%2Chtml-tag
google_site_verification: # your google-site-verification ID (Google Search Console)
Expand Down Expand Up @@ -228,6 +229,7 @@ plugins:
- jemoji

# al-folio plugins
- al_analytics
- al_citations
- al_ext_posts

Expand Down Expand Up @@ -392,10 +394,6 @@ lazy_loading_images: true # enables lazy loading of images (recommended)
# Optional Features
# -----------------------------------------------------------------------------

enable_google_analytics: false # enables google analytics
enable_cronitor_analytics: false # enables cronitor RUM analytics
enable_pirsch_analytics: false # enables Pirsch analytics (https://pirsch.io/)
enable_openpanel_analytics: false # enables Openpanel analytics (https://openpanel.dev/)
enable_google_verification: false # enables google site verification
enable_bing_verification: false # enables bing site verification
enable_masonry: true # enables automatic project cards arrangement
Expand Down
24 changes: 2 additions & 22 deletions _includes/scripts.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -212,29 +212,9 @@
{% endunless %}
{% endif %}

{% if site.enable_google_analytics %}
{% if site.plugins contains 'al_analytics' %}
<!-- Analytics -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
<script defer src="{{ '/assets/js/google-analytics-setup.js' | relative_url | bust_file_cache }}"></script>
{% endif %}

{% if site.enable_cronitor_analytics %}
<!-- Cronitor RUM -->
<script async src="https://rum.cronitor.io/script.js"></script>
<script defer src="{{ '/assets/js/cronitor-analytics-setup.js' | relative_url | bust_file_cache }}"></script>
{% endif %}
{% if site.enable_pirsch_analytics %}
<script
defer
src="https://api.pirsch.io/pa.js"
id="pianjs"
data-code="{{ site.pirsch_analytics }}"
></script>
{% endif %}
{% if site.enable_openpanel_analytics %}
<script defer src="{{ '/assets/js/open-panel-analytics-setup.js' | relative_url | bust_file_cache }}"></script>
<script async defer src="https://openpanel.dev/op1.js"></script>
{% al_analytics_scripts %}
{% endif %}

{% if site.enable_progressbar %}
Expand Down
6 changes: 0 additions & 6 deletions assets/js/cronitor-analytics-setup.js

This file was deleted.

6 changes: 0 additions & 6 deletions assets/js/google-analytics-setup.js

This file was deleted.

11 changes: 0 additions & 11 deletions assets/js/open-panel-analytics-setup.js

This file was deleted.

0 comments on commit 0b49426

Please sign in to comment.