├── .gitignore ├── .prettierignore ├── 404.md ├── CNAME ├── Gemfile ├── Gemfile.lock ├── README.md ├── _config.yml ├── _docs ├── 10_general │ ├── 00_bots.md │ ├── 01_introduction.md │ ├── 02_locations.md │ ├── 03_how-to-use-url-params.md │ ├── 10_what_we_collect.md │ ├── 15_metrics.md │ └── 50_support.md ├── 20_install-script │ ├── 00_light.md │ ├── 00_v10.md │ ├── 00_v8.md │ ├── 00_v9.md │ ├── 01_script.md │ ├── 02_custom.md │ ├── 04_install.md │ ├── 05_analytics.md │ ├── 10_without-javascript.md │ ├── 17_collect-on-amp.md │ ├── 19_sri.md │ ├── 20_csp.md │ └── 25_proxy.md ├── 20_script-settings │ ├── 03_dnt.md │ ├── 03_hash.md │ ├── 03_overwrite-domain.md │ ├── 03_overwrite-path.md │ ├── 04_ignore-metrics.md │ ├── 04_ignore-pages.md │ ├── 05_allow-url-parameters.md │ ├── 30_non-unique-hostnames.md │ └── 40_strict-utms.md ├── 30_features │ ├── 00_block-your-visits-on-safari.md │ ├── 07-goals.md │ ├── 08_custom-views.md │ ├── 10_mini-websites.md │ ├── 11-filters.md │ ├── 12-export-your-data.md │ ├── 12-import-google-analytics-data.md │ ├── 15_email-reports.md │ ├── 20_bypass.md │ ├── 22-advanced-robot-blocking.md │ ├── 25_hide-spam.md │ ├── 27_certificate-checks.md │ ├── 30_embed-chart.md │ ├── 33_trend-lines.md │ ├── 38_annotations.md │ ├── 40_extension.md │ ├── 42-exclude-your-ip.md │ └── 45_ios-app.md ├── 31_integrations │ ├── 00_astro.md │ ├── 00_create-plugin.md │ ├── 00_django.md │ ├── 00_docusaurus.md │ ├── 00_gatsby.md │ ├── 00_godaddy.md │ ├── 00_gridsome.md │ ├── 00_hugo.md │ ├── 00_jimdo.md │ ├── 00_mailerlite.md │ ├── 00_next.md │ ├── 00_nuxt.md │ ├── 00_react.md │ ├── 00_rubyonrails.md │ ├── 00_swift.md │ ├── 00_vue.md │ ├── 00_vuepress.md │ ├── 00_wordpress-head-footer-code-plugin.md │ ├── 00_wordpress-refined-practice.md │ ├── 05_wordpress.md │ ├── 06_wordpress_wpfullpicture.md │ ├── 10_webflow.md │ ├── 15_squarespace.md │ ├── 20_chartbrew.md │ ├── 25_wix.md │ ├── 30_cloudflare.md │ ├── 35_ghost.md │ ├── 40_google-tag-manager.md │ ├── 45_looker-studio.md │ ├── 50_power_bi.md │ ├── 55_cloudquery.md │ ├── 60_dailytics.md │ └── 65_caniuse.md ├── 33_explained │ ├── 02_time-on-page.md │ ├── 05_uniques.md │ ├── 10_team-roles.md │ └── 15_domain-privacy.md ├── 36_legal │ ├── 00_introduction.md │ ├── 01_privacy.md │ ├── 03_compliance.md │ ├── 04_compliance-faq.md │ ├── 05_data-collection.md │ └── 06_data-security-and-ownership.md ├── 40_affiliate-program │ ├── 01_how-it-works.md │ └── 03_terms-of-service.md ├── 50_api │ ├── 01_introduction.md │ ├── 10_authenticate.md │ ├── 15_stats-api.md │ ├── 20_export-data-points.md │ ├── 35_admin.md │ ├── 40_cors-jsonp.md │ └── 50_helpers.md ├── 55_events │ ├── 00_collect-events-on-ios.md │ ├── 00_inline-events.md │ ├── 00_send-events-in-ruby.md │ ├── 01_introduction.md │ ├── 02_explorer.md │ ├── 05_automated-events.md │ ├── 15_metadata.md │ ├── 20-sa-link-event.md │ └── 50_server-side.md └── 60_account │ ├── 10_change-plan.md │ ├── 20_passwords.md │ ├── 25_transfer-websites.md │ ├── 30_invoices.md │ ├── 40_cancel.md │ └── 50_delete.md ├── _includes └── video.html ├── _layouts └── default.html ├── _sass ├── base.scss ├── footer.scss ├── header.scss ├── highlighting.scss ├── simpleanalytics.scss └── variables.scss ├── css └── app.scss ├── images ├── account-invoices.png ├── app-store-badge.svg ├── chartbrew-add-visitors.png ├── chartbrew-chart-options.png ├── chartbrew-create-connection.png ├── chartbrew-create-data-set.png ├── chartbrew-create-new-dashboard.png ├── chartbrew-dashboard-simple-analytics-themed.png ├── chartbrew-dashboard.png ├── chartbrew-make-request-again.png ├── chartbrew-make-request.png ├── chartbrew-select-table.png ├── chartbrew-select-utm-sources.png ├── chartbrew-test-request.png ├── chartbrew-y-axis.png ├── cloudflare-01.jpg ├── cloudflare-02.jpg ├── cloudflare-03.jpg ├── cloudflare-04.jpg ├── cloudflare-05.jpg ├── cloudflare-06.jpg ├── cloudflare-dns-custom-domain.png ├── dailytics-final-result.gif ├── dailytics-form-01.png ├── dailytics-form-02.png ├── dailytics-form-03.png ├── direct-visit.jpg ├── email-report-setting.png ├── email-report.png ├── extension-chrome-closeup.jpg ├── extension-chrome-options.jpg ├── ghost-add-code.jpg ├── ghost-click-code-injection.jpg ├── ghost-save-code.jpg ├── hugo-logo.svg ├── jimdo-add-element.png ├── jimdo-add-html.png ├── mailerlite-add-html.jpg ├── mailerlite-disable-analytics.jpg ├── mailerlite-save.jpg ├── mini-websites-arrow.jpg ├── mini-websites-simple-analytics.gif ├── password-done.jpg ├── password-fill.jpg ├── password-set.jpg ├── pencil.svg ├── pixel-check-feedback.jpg ├── referrer-visit.jpg ├── script-in-safari-sri-version.png ├── spam-click-on-link.jpg ├── spam-confirm.jpg ├── spam-download-a-copy.jpg ├── spam-more-than-10000.jpg ├── spam-overview.jpg ├── spam-verify.jpg ├── squarespace-click-on-advanced.jpg ├── squarespace-click-on-code-injection.jpg ├── squarespace-click-on-settings.jpg ├── squarespace-paste-embed-code.jpg ├── squarespace-save-embed-code.jpg ├── time-on-page-ga-stop.png ├── time-on-page-ga.png ├── time-on-page-sa.png ├── webflow-footer-code.png ├── webflow-head-code.png ├── wix-select-analytics.jpg ├── wix-select-custom.jpg ├── wordpress-click-activate-plugin.jpg ├── wordpress-click-add-new-plugin.jpg ├── wordpress-click-browse.jpg ├── wordpress-click-install-now.jpg ├── wordpress-click-upload-plugin.jpg ├── wordpress-installed-plugins.jpg ├── wordpress-refined-practice-screenshot-dashboard.png ├── wordpress-refined-practice-screenshot-settings-page.png ├── wordpress-select-file.jpg ├── wp-full-picture-simple-analytics-installation-2.png ├── wp-full-picture-simple-analytics-installation.png └── wp-full-picture-simple-analytics-settings.png ├── js └── pjax.min.js ├── package.json └── pages.json /.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | .sass-cache 3 | .jekyll-metadata 4 | .vscode 5 | _docs/35_legal 6 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | /js 2 | -------------------------------------------------------------------------------- /404.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Oops, not found 3 | layout: default 4 | download: false 5 | sitemap: false 6 | --- 7 | 8 | [Go back](/) to the homepage of our docs. 9 | 10 | 11 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | docs.simpleanalytics.com -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | # Hello! This is where you manage which Jekyll version is used to run. 4 | # When you want to use a different version, change it below, save the 5 | # file and run `bundle install`. Run Jekyll with `bundle exec`, like so: 6 | # 7 | # bundle exec jekyll serve 8 | # 9 | # This will help ensure the proper Jekyll version is running. 10 | # Happy Jekylling! 11 | gem 'github-pages', group: :jekyll_plugins 12 | gem "webrick", "~> 1.7" 13 | 14 | # If you have any plugins, put them here! 15 | group :jekyll_plugins do 16 | gem 'jekyll-redirect-from' 17 | gem "jekyll-feed", "~> 0.6" 18 | end 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Simple Analytics logo 3 | 4 | 5 | # Documentation 6 | 7 | Please submit PRs for everything including grammar errors :smile: 8 | 9 | ## Run on your computer 10 | 11 | ``` 12 | bundle exec jekyll serve 13 | ``` 14 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | # Welcome to Jekyll! 2 | # 3 | # This config file is meant for settings that affect your whole blog, values 4 | # which you are expected to set up once and rarely edit after that. If you find 5 | # yourself editing this file very often, consider using Jekyll's data files 6 | # feature for the data you need to update frequently. 7 | # 8 | # For technical reasons, this file is *NOT* reloaded automatically when you use 9 | # 'bundle exec jekyll serve'. If you change this file, please restart the server process. 10 | host: localhost 11 | 12 | # Site settings 13 | # These are used to personalize your new site. If you look in the HTML files, 14 | # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. 15 | # You can create any custom variable you would like, and they will be accessible 16 | # in the templates via {{ site.myvariable }}. 17 | title: Simple Analytics Docs 18 | email: support@simpleanalytics.com 19 | hostname: docs.simpleanalytics.com 20 | description: >- # this means to ignore newlines until "baseurl:" 21 | On this website you'll find all the ways and possibilities how to use Simple Analytics. 22 | Installing the script, how to use features, and how we handle things, to name a few. 23 | baseurl: "" # the subpath of your site, e.g. /blog 24 | url: https://docs.simpleanalytics.com 25 | twitter_username: simpleanalytic 26 | github_username: simpleanalytics 27 | 28 | # Variables 29 | api_version: 5 30 | url: https://docs.simpleanalytics.com 31 | 32 | # Build settings 33 | # markdown: kramdown 34 | theme: null 35 | plugins: 36 | - jekyll-feed 37 | - jekyll-seo-tag 38 | - jekyll-redirect-from 39 | - jekyll-sitemap 40 | 41 | # Exclude from processing. 42 | # The following items will not be processed, by default. Create a custom list 43 | # to override the default setting. 44 | # exclude: 45 | # - Gemfile 46 | # - Gemfile.lock 47 | # - node_modules 48 | # - vendor/bundle/ 49 | # - vendor/cache/ 50 | # - vendor/gems/ 51 | # - vendor/ruby/ 52 | 53 | sass: 54 | style: compressed 55 | sass_dir: _sass 56 | 57 | collections: 58 | docs: 59 | output: true 60 | permalink: /:title 61 | 62 | defaults: 63 | - scope: 64 | path: "" # an empty string here means all files in the project 65 | values: 66 | layout: "default" 67 | 68 | encoding: utf-8 69 | -------------------------------------------------------------------------------- /_docs/10_general/00_bots.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Bots 3 | hidden: true 4 | category: general 5 | permalink: /bots 6 | last_modified_at: 2022-04-14 7 | --- 8 | 9 | We have a few bots that work for us :) 10 | 11 | A few use-cases where we use our bots: 12 | - When a customer adds a website we check if the script is installed correctly 13 | - If a website doesn't have traffic anymore, we send a fake page view to detect our (missing) script
_(it's blocked by most analytics tools because we add `bot` in the User-Agent string)_ 14 | - We also check which technologies are used on their website so we can show the best plugin for their needs 15 | - We generate screenshots of public referral pages 16 | 17 | > You can to disable alerts for your missing script in [your website settings](https://simpleanalytics.com/select-website/settings#alerts). 18 | 19 | The bots are usually identified with this User-Agent string: 20 | 21 | ``` 22 | Mozilla/5.0 (compatible; SimpleAnalyticsBot/1.0; +https://docs.simpleanalytics.com/bots) 23 | ``` 24 | 25 | Do you think this bot is causing noise? Please [let us know](https://simpleanalytics.com/contact)! 26 | -------------------------------------------------------------------------------- /_docs/10_general/01_introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Simple Analytics documentation 3 | category: general 4 | menu: Introduction 5 | permalink: / 6 | download: false 7 | last_modified_at: 2022-04-14 8 | --- 9 | 10 | Simple Analytics is a privacy-friendly and simple alternative to Google Analytics. No cookies. No trackers. **No consent required from your visitors**. Just straightforward analytics. 11 | 12 | [Check our live demo](https://dashboard.simpleanalytics.com/simpleanalytics.com) to see what that looks like! 13 | 14 | Built and hosted in the EU 🇪🇺, we believe in an internet that is friendly to website visitors. 15 | 16 | If this resonates, we'd love to have you onboard! 17 | 18 | To get started quickly: 19 | 20 | - [Add Simple Analytics to your website](https://docs.simpleanalytics.com/script) 21 | - [Import your Google Analytics data](https://docs.simpleanalytics.com/import-google-analytics-data) 22 | - [Set up your events](https://docs.simpleanalytics.com/events) 23 | - [Read more about compliance and the datapoints that we collect](https://docs.simpleanalytics.com/introduction-to-legal) 24 | 25 | Looking for a troubleshooting guide? [Here you go](https://www.simpleanalytics.com/blog/debug-simple-analytics-script). If you have any other questions, just let us know [here](https://dashboard.simpleanalytics.com/contact). 26 | 27 | 28 | -------------------------------------------------------------------------------- /_docs/10_general/50_support.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Support 3 | category: general 4 | permalink: /support 5 | last_modified_at: 2023-09-27 6 | --- 7 | 8 | Should you need to get in touch with our support team, please use [our contact form or email address](https://simpleanalytics.com/contact). 9 | 10 | ## Customer support code 11 | 12 | Occasionally, we might request a _customer support code_ to verify your identity. This unique code is personal and should not be shared with others. 13 | 14 | ### Finding your customer support code 15 | 16 | 1. Navigate to [your account settings](https://simpleanalytics.com/account#support). 17 | 2. Locate your Customer Support Code as shown below: 18 | 19 | Simple Analytics account settings with customer support code 20 | 21 | _Note: We may reset your customer support code without notice. Ensure to provide the most recent code when we ask for it._ 22 | -------------------------------------------------------------------------------- /_docs/20_install-script/00_light.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Light version script 3 | category: install-script 4 | hidden: true 5 | permalink: /light 6 | last_modified_at: 2022-07-26 7 | --- 8 | 9 | Our script is already very light, but some customers love it even lighter. That's why we always create two versions of our script: normal and light. 10 | 11 | Just replace `latest.js` with `light.js` in your embed script. It will look similar to this: 12 | 13 | 14 | ```html 15 | 16 | 17 | ``` 18 | 19 | We support both Brotli and Gzip compression depending on the browser capabilities. To get an idea of our file sizes: 20 | 21 | | Script | Compressed size (Gzip) | Compressed size (Brotli) | Uncompressed size | 22 | | --------- | ---------------------- | ------------------------ | ----------------- | 23 | | light.js | 1.9 KB | 2.0 KB | 3.3 KB | 24 | | latest.js | 3.7 KB | 3.8 KB | 6.9 KB | 25 | 26 | Source: [giftofspeed.com](https://www.giftofspeed.com/gzip-test/) for Brotli, [adresults.nl/tools/gzip-compression-test](https://adresults.nl/tools/gzip-compression-test) for Gzip. 27 | 28 | ## Features 29 | 30 | Obviously not all features are available in our light script. Here an comparison of both versions: 31 | 32 | | Feature | `latest.js` | `light.js` | 33 | | :---------------------------------------------- | :---------: | :--------: | 34 | | Page views | x | x | 35 | | Referrer | x | x | 36 | | UTM codes | x | x | 37 | | [Uniques](/uniques) | x | x | 38 | | [Events](/events) | x | x | 39 | | Bot detection | x | x | 40 | | Error reporting | x | x | 41 | | Show warnings | x | x | 42 | | Time on page | x | | 43 | | [Hash navigation](/hash-mode) | x | | 44 | | Scroll depth | x | | 45 | | [SPA](/trigger-custom-page-views) | x | | 46 | | Screen sizes | x | | 47 | | [Ignore pages](/ignore-pages) | x | | 48 | | [Overwrite domain name](/overwrite-domain-name) | x | | 49 | | [Ignore DNT](/dnt) | x | | 50 | -------------------------------------------------------------------------------- /_docs/20_install-script/00_v10.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Embed script v10 3 | category: install-script 4 | hidden: true 5 | permalink: /script/v10 6 | last_modified_at: 2022-09-05 7 | created_at: 2022-09-05 8 | --- 9 | 10 | This is a tiny update with only 2 changes. 11 | 12 | - We fixed a bug where the [callback didn't trigger in `sa_event`](https://github.com/simpleanalytics/scripts/commit/334bd5bd486718c3326eb42a95fa640dcbf07c1d#diff-ee91055a491d35f130f742d7e34ee9a6042ba4458ec6a7698eb2e8b40c8f9729) when metadata was specified. 13 | - We allow for [`sa_settings`](https://github.com/simpleanalytics/scripts/commit/f83d48e5fc5453cc79c79d877d318b97919f51d9) to communicate settings to the script from JavaScript directly. Created for [our official Google Tag Manager tag](https://tagmanager.google.com/gallery/#/owners/simpleanalytics/templates/google-tag-manager). 14 | 15 | If you are a developer you might want to see [what changed](https://github.com/simpleanalytics/scripts/compare/f83d48e5fc5453cc79c79d877d318b97919f51d9...d593d339e11c86f29d590dfb337b775a4fef37bd) in our open-source repository. 16 | -------------------------------------------------------------------------------- /_docs/20_install-script/00_v8.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Embed script v8 3 | category: install-script 4 | hidden: true 5 | permalink: /script/v8 6 | last_modified_at: 2022-04-14 7 | --- 8 | 9 | We updated our public script. It has some cool new features. 10 | 11 | ## Strict UTM 12 | 13 | To track campaigns you use UTM-codes. There are 5 different codes: `utm_source`, `utm_campaign`, `utm_medium`, `utm_content`, and `utm_term`. To make it more readable we allow customers to use the aforementioned codes plus `ref`, `source`, `campaign`, `medium`, `content`, and `term`. 14 | 15 | But for some customers this is not desirable, so we created a way to opt-out. Add `data-strict-utm="true"` to the embed script and we only allow the following codes: `utm_source`, `utm_campaign`, `utm_medium`, `utm_content`, and `utm_term`. 16 | 17 | ## Auto Events 18 | 19 | We support collecting events with our auto events script. It's now available for custom domains as well. 20 | 21 | ## Sessions ID 22 | 23 | We added a session ID to page views. This makes it possible to link events to page views. 24 | 25 | ## Build on top of events 26 | 27 | It's now easier to test and build on top of events for developers. Previously, we would forbid our script on localhost to prevent data being send from the developers' computer. We now allow it and show a warning in the Developer Console of the browser when this happens. We allow events and page views to be send from localhost. 28 | 29 | It's usually a good idea to set `data-hostname="example.com"` when working locally, so we know we should add the events to `example.com`. 30 | 31 | ## Bugs 32 | 33 | We fixed a bug where invalid events where saved in apps that used [prototypes on JavaScript Objects](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object_prototypes). 34 | 35 | If you are a developer you might want to see [what changed](https://github.com/simpleanalytics/scripts/compare/26009ec29abe26ae585a632d41ea01aff3fed3ec...3874b44ce5f1b0b8a7d50fb512fdcf5285a0138f) in our open-source repository. 36 | -------------------------------------------------------------------------------- /_docs/20_install-script/00_v9.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Embed script v9 3 | category: install-script 4 | hidden: true 5 | permalink: /script/v9 6 | last_modified_at: 2022-07-26 7 | created_at: 2022-07-26 8 | --- 9 | 10 | Exciting news, our public script just got a massive update. We are now at V9. 11 | 12 | ## Ignore metrics 13 | 14 | Our script does only collect non-personal data. But some customers might want to limit [our metrics](/metrics) even more. That's why we created the [ignore metrics feature](/ignore-metrics). 15 | 16 | ## Add metadata to events & page views 17 | 18 | You can now [add metadata](/metadata) to your data. ~~Although you can't see it in our dashboard or APIs currently, it's possible to send the data already.~~ 19 | 20 | ## Overwrite path 21 | 22 | You can now [change the path](/overwrite-path) of your page views and events before they are sent to our servers. 23 | 24 | ## Allow extra URL parameters 25 | 26 | By default, we collect all UTM parameters and the `ref` (which is short for `utm_source`) parameter. We don't store the rest of the query parameters. But some customers have non-personal data in their query parameters—for example, `product-id` or `article-slug`. [We allow collecting those parameters](/allow-params) now as well as long as they will be specified via our script settings. 27 | 28 | ## Detect browsers better 29 | 30 | We improved the way we identify Brave. In recent versions of the Brave browser, you will get the Brave version as well. 31 | 32 | Both [Polypane](https://polypane.app/) and [Responsively](https://responsively.app/) will be registered as robots. 33 | 34 | ## Non-unique hostnames 35 | 36 | Suppose you redirect your visitors to a payment provider, and after they complete the payment, they return to your website. Because of the nature of not tracking visitors in Simple Analytics, we count those "returning" visitors as new visitors. To prevent this from happening, [you can specify the hostname](/non-unique-hostnames) of that payment provider to tell us we should register this visit as non-unique. 37 | 38 | ## Bugs 39 | 40 | - Fixed issue with [sendBeacon](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon) that didn't always sent data back to our servers ([#]()) 41 | - Fixed missing source map for SRI version 42 | 43 | If you are a developer you might want to see [what changed](https://github.com/simpleanalytics/scripts/compare/3874b44ce5f1b0b8a7d50fb512fdcf5285a0138f...v9) in our open-source repository. 44 | -------------------------------------------------------------------------------- /_docs/20_install-script/01_script.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to add our script 3 | category: install-script 4 | permalink: /script 5 | last_modified_at: 2022-04-14 6 | --- 7 | 8 | Include these two lines on every page at the end of your `` (or anywhere else): 9 | 10 | 11 | ```html 12 | 13 | 14 | ``` 15 | 16 | > To install the script on Wordpress, Ghost, WIX, Squarespace, Webflow, Gatsby, Vue, Django, Ruby, and others, go to [Install on other platforms](/install-on-other-platforms). 17 | 18 | We have a website setup wizard to test if you installed your script correctly. If you still have problems installing it, please let us know! We helped a lot of people with setting up their script and we love to help you as well. Just [contact](https://simpleanalytics.com/contact) us. 19 | 20 | ## Server-side tracking 21 | 22 | We support server-side tracking, [read more about it here](https://docs.simpleanalytics.com/events/server-side#page-views). 23 | 24 | ## Non-JavaScript environments 25 | 26 | While most people browse the internet with JavaScript enabled, there are still some users who disable it, fully aware that many websites may not function as intended. If you want to capture data from these visitors, consider adding our `noscript` tag. Be aware that this may also increase traffic from bots, as some don’t have JavaScript enabled. 27 | 28 | 29 | ```html 30 | 31 | ``` 32 | 33 | ## Developers 34 | 35 | With Simple Analytics you don't need to manually trigger page views in SPA. We automatically trigger page views in [_Single Page Apps_ (SPA's)](/trigger-custom-page-views) like React, Vue, and Angular. You can also use [hash navigation](/hash-mode) to trigger page views. 36 | 37 | Some people like a very light script. All our scripts are heavily compressed and we have [an extra light](/light) version. 38 | 39 | If you want to run the script on localhost, please use our dev (`https://scripts.simpleanalyticscdn.com/latest.dev.js`) version. Note the `.dev` part. You might want to [overwrite your hostname](/overwrite-domain-name) from localhost to something like `dev.example.com` (where `example.com` is your domain) to receive it in your dashboard. Make sure to remove the `.dev` part from the script on production. 40 | 41 | When you are done implementing [go to your dashboard](https://simpleanalytics.com/websites). 42 | 43 | If you encounter issues, don't hesitate to contact us via [our support channels](https://simpleanalytics.com/contact). 44 | 45 | ### Javascript version 46 | 47 | If you can't embed HTML, but you can embed JavaScript, here is the code you need to install Simple Analytics with just JavaScript. 48 | 49 | ```js 50 | // Simple Analytics - 100% privacy-first analytics 51 | const script = document.createElement("script"); 52 | script.setAttribute("src", "https://scripts.simpleanalyticscdn.com/latest.js"); 53 | document.head.appendChild(script); 54 | ``` 55 | 56 | ## Open source 57 | 58 | Our user facing scripts are [open source on GitHub](https://github.com/simpleanalytics/scripts). 59 | 60 | 61 | -------------------------------------------------------------------------------- /_docs/20_install-script/02_custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Trigger custom page views 3 | category: install-script 4 | permalink: /trigger-custom-page-views 5 | last_modified_at: 2022-04-14 6 | --- 7 | 8 | Normally you want to trigger a custom page view for _Single Page Apps_ (SPA's) like React, Vue, and Angular. Because pages are not completely reloaded on navigation we need a way to track those navigations as page views. 9 | 10 | For some analytics tools like Google Analytics you need to trigger a page view via their script. For Simple Analytics this is different. 11 | 12 | > With Simple Analytics there is **no** need to implement anything to detect page views in SPA's. It all works out of the box. 13 | 14 |
15 | Technical explanation 16 |
17 | 18 | We make this work by overwriting the native `pushState`-function of the browser. 19 | 20 | ```js 21 | // We check if the browser supports pushState 22 | if (history.pushState && Event && dispatchEvent) { 23 | // We create a listener based on the original browser feature 24 | var stateListener = function (type) { 25 | var orig = history[type]; 26 | return function () { 27 | var rv = orig.apply(this, arguments); 28 | var event = new Event(type); 29 | event.arguments = arguments; 30 | dispatchEvent(event); 31 | return rv; 32 | }; 33 | }; 34 | 35 | // We connect our own created a listener to the pushState feature 36 | history.pushState = stateListener("pushState"); 37 | 38 | // Now we can listen for pushState events and keep the original feature of the browser working 39 | window.addEventListener("pushState", function () { 40 | // Here we trigger the page view 41 | }); 42 | } 43 | ``` 44 | 45 | You can read our source code [on GitHub](https://github.com/simpleanalytics/scripts/blob/4ad5c1b6cb4c42ae2e483dc43a578e25399d53a4/src/default.js#L120-L137). 46 | 47 |
48 |
49 | 50 | ## Use custom collection anyway 51 | 52 | There might be situation where you don't want to auto collect page views. When you add the `data-auto-collect="false"` attribute you can expose a function called `sa_pageview`. When you call this function, the script will send a page view with the path you give as a parameter. If you don't give a path it will use `window.location.pathname` as a default. 53 | 54 | ```html 55 | 62 | 63 | 69 | 75 | ``` 76 | 77 | If you encounter issues, don't hesitate to contact us via [our support channels](https://simpleanalytics.com/contact). 78 | -------------------------------------------------------------------------------- /_docs/20_install-script/04_install.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Install Simple Analytics on other platforms 3 | menu: Install on other platforms 4 | category: install-script 5 | permalink: /install-on-other-platforms 6 | last_modified_at: 2022-11-04 7 | --- 8 | 9 | ## Platform guides 10 | 11 | We try to make installing Simple Analytics as simple as possible. We want privacy to be accessible as possible. We don't require the need for a developer if you use any of the following tools. 12 | 13 | Read our guides on how to install Simple Analytics on: 14 | 15 | - [Google Tag Manager](/install-simple-analytics-with-google-tag-manager) (source on [GitHub](https://github.com/simpleanalytics/google-tag-manager#readme)) 16 | - [Wordpress](/install-simple-analytics-on-wordpress) (source on [GitHub](https://github.com/simpleanalytics/wordpress-plugin#readme)) 17 | - [Ghost](/install-simple-analytics-on-ghost) 18 | - [CloudFlare](/install-simple-analytics-on-cloudflare) (source on [GitHub](https://github.com/simpleanalytics/cloudflare-app#readme)) 19 | - [WIX](/install-simple-analytics-on-wix) 20 | - [Squarespace](/install-simple-analytics-on-squarespace) 21 | - [Webflow](/install-simple-analytics-on-webflow) 22 | - [Jimdo Creator](/install-simple-analytics-on-jimdo-creator) 23 | - [MailerLite](/install-simple-analytics-on-mailerlite) 24 | - [GoDaddy](/install-simple-analytics-on-godaddy) 25 | - [Netlify](https://app.netlify.com/extensions/simpleanalytics) 26 | 27 | > Are you missing your favorite platform? [Let us know!](https://simpleanalytics.com/contact) Happy to create a guide or plugin for you. 28 | 29 | ## Framework plugins 30 | 31 | For most frameworks, you can include the script. We magically track page views, so you don't have to change your app code. [Read on how we do that](/trigger-custom-page-views). For some, we got requests to create a plugin for them. 32 | 33 | {% assign currentDate = 'now' | date: '%s' | plus: 0 %} 34 | {% assign threeMonthsLater = '2023-02-07' | date: '%s' | plus: 7884000 %} 35 | 36 | Get our official plugins for these frameworks: 37 | 38 | - [React](/install-simple-analytics-with-react) (guide only) 39 | - [Ruby on Rails](/install-simple-analytics-with-ruby-on-rails) (source on [GitHub](https://github.com/simpleanalytics/rubyonrails-plugin#readme)) 40 | - [Gatsby](/install-simple-analytics-with-gatsby) (source on [GitHub](https://github.com/simpleanalytics/gatsby-plugin#readme)) 41 | - [Vue](/install-simple-analytics-with-vue) (source on [GitHub](https://github.com/simpleanalytics/vue-plugin#readme)) 42 | - [VuePress](/install-simple-analytics-with-vuepress) (source on [GitHub](https://github.com/simpleanalytics/vuepress-plugin#readme)) 43 | - [Nuxt.js](/install-simple-analytics-with-nuxt) (guide only) 44 | - [Gridsome](/install-simple-analytics-with-gridsome) (source on [GitHub](https://github.com/simpleanalytics/gridsome-plugin#readme)) 45 | - [Django](/install-simple-analytics-with-django) (source on [GitHub](https://github.com/simpleanalytics/django-plugin#readme)) 46 | - [Analytics library](/install-simple-analytics-via-analytics-package) (source on [GitHub](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-simple-analytics)) 47 | - [Hugo](/install-simple-analytics-with-hugo) (guide only) 48 | - [Next.js](/install-simple-analytics-with-next) (guide only) 49 | - [Docusaurus](/install-simple-analytics-with-docusaurus) (source on [GitHub](https://github.com/simpleanalytics/docusaurus-plugin#readme)) 50 | - [Astro](https://github.com/simpleanalytics/astro-plugin) (guide on GitHub) 51 | 52 | > Are you missing your favorite framework? [Let us know!](https://simpleanalytics.com/contact) Happy to create a plugin for you. 53 | -------------------------------------------------------------------------------- /_docs/20_install-script/05_analytics.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Install Simple Analytics with the Analytics library 3 | category: install-script 4 | hidden: true 5 | permalink: /install-simple-analytics-via-analytics-package 6 | last_modified_at: 2022-04-14 7 | --- 8 | 9 | You can install Simple Analytics using the open-source Analytics library ([website](https://getanalytics.io), [npm](https://www.npmjs.com/package/analytics)). It's a pluggable library designed as an abstraction layer to customize your app's analytics requirements easily. 10 | 11 | ## Install via npm 12 | 13 | ```bash 14 | npm install analytics @analytics/simple-analytics 15 | ``` 16 | 17 | ## Using the Analytics library 18 | 19 | The Analytics library works with any frontend framework, including `react`, `vue`, `angular` or static `html`. 20 | 21 | To use it: 22 | 23 | 1. Import the `analytics` library and `@analytics/simple-analytics` 24 | 2. Initialize the `analytics` library 25 | 3. Page views get tracked automatically 26 | 4. Include the non-javascript fallback in your `html` 27 | 28 | Example code: 29 | 30 | ```js 31 | /* src/analytics.js */ 32 | import Analytics from "analytics"; 33 | import simpleAnalyticsPlugin from "@analytics/simple-analytics"; 34 | 35 | const analytics = Analytics({ 36 | app: "awesome-app", 37 | plugins: [ 38 | // Load simple analytics! 🎉 39 | simpleAnalyticsPlugin(), 40 | ], 41 | }); 42 | 43 | /* All page views are now tracked by simple analytics */ 44 | ``` 45 | 46 | Make sure to include this file in the entry point of your application. This will ensure the Analytics library and Simple Analytics scripts load correctly. 47 | 48 | When the Analytics library is initialized it will automatically load the simple analytics script onto the page. 49 | 50 | For additional instructions on how to use with other frontend frameworks, check out the [Analytics library docs](https://getanalytics.io/tutorial/getting-started/) 51 | 52 | ## Include non-JS enabled browser fallback 53 | 54 | Remember to include the `noscript` image tag in your HTML for JS-disabled browsers. 55 | 56 | Include this line at the end of your `` 57 | 58 | 59 | ```html 60 | 61 | ``` 62 | 63 | ## View the source 64 | 65 | You can view the source code of this plugin on [GitHub](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-simple-analytics) 66 | 67 | If you encounter issues, don't hesitate to contact us via [our support channels](https://simpleanalytics.com/contact). 68 | -------------------------------------------------------------------------------- /_docs/20_install-script/19_sri.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SRI version 3 | category: install-script 4 | permalink: /sri 5 | sriVersion: 11 6 | sriHash: sha256-hkUzQr3zWmSDnmhw95ZmQSZ949upqD+ML9ejiN0UIIE= sha384-rfv15RJy1bBYZ1Mf4xizO26jorXb2myipCvHXy4rkG0SuEET96S+m0sTzu5vfbSI sha512-lQzjzTbOxHLwkZGDVMf4V0sm8v2Mrqm73IvKcXBftJ/MSZKQC4/jwKFToxT+3IVAVWQzLplSNHH8gM5d7b1BSg== 7 | last_modified_at: 2023-05-03 8 | --- 9 | 10 | If you want to use SRI you can do this by using specific scripts. The default scripts are changing to reflect new features or code optimizations. You want to use SRI if you consider it a risk when our scripts change. You can also host our SRI script on your own server or CDN. 11 | 12 | When you want to use our SRI version of our script you will need to update your script to `https://scripts.simpleanalyticscdn.com/sri/v{{ page.sriVersion }}.js`. The full embed script becomes: 13 | 14 | 15 | ```html 16 | 17 | 18 | ``` 19 | 20 | When using a [custom domain](/bypass-ad-blockers) you need to use this script: `https://CUSTOM.DOMAIN/v{{ page.sriVersion }}/app.js`. Replace the `CUSTOM.DOMAIN` with your custom domain. To generate an SRI hash for your custom domain you can use [report-uri.com](https://report-uri.com/home/sri_hash) or [srihash.org](https://www.srihash.org/). 21 | 22 | To verify if our script is an SRI version you can always check for `SRI-version` in the first line: 23 | 24 | SRI script viewed in a browser 25 | -------------------------------------------------------------------------------- /_docs/20_install-script/20_csp.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Content Security Policy 3 | category: install-script 4 | permalink: /csp 5 | last_modified_at: 2022-07-14 6 | --- 7 | 8 | Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft to site defacement to distribution of malware. [Read more on CSP at MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP). 9 | 10 | ## Content-Security-Policy header 11 | 12 | For Simple Analytics you want to add the following Content Security Policy header (we included `'self'` for all as well): 13 | 14 | 15 | ``` 16 | Content-Security-Policy: script-src 'self' 'unsafe-inline' https://scripts.simpleanalyticscdn.com; connect-src 'self' https://queue.simpleanalyticscdn.com; img-src 'self' https://queue.simpleanalyticscdn.com https://simpleanalyticsbadges.com; 17 | ``` 18 | 19 | ## Content-Security-Policy meta tag 20 | 21 | Alternatively, a `` element can be used to configure a policy, for example: 22 | 23 | ``` 24 | 25 | ``` 26 | 27 | Basically we use `https://scripts.simpleanalyticscdn.com` for our public script, `https://queue.simpleanalyticscdn.com` to send Beacon API data and error requests, and we use `https://queue.simpleanalyticscdn.com` also for sending data through our "pixel". If you show our badge, you need to have `https://simpleanalyticsbadges.com`. 28 | 29 | ## Why `script-src 'unsafe-inline'`? 30 | 31 | If you use the automated events, make sure to have `'unsafe-inline'` in your `script-src`, otherwise you can remove that from the examples above. We use `'unsafe-inline'` to add [`onClick`](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event) event listeners to your download buttons, email links, and outbound links. 32 | 33 | Don't forget to add your own assets to the above Content Security Policy. 34 | -------------------------------------------------------------------------------- /_docs/20_script-settings/03_dnt.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Do Not Track 3 | category: script-settings 4 | permalink: /dnt 5 | last_modified_at: 2024-12-02 6 | --- 7 | 8 | > This page is about the DNT setting in browsers. We don't track your visitors, [read more on what we collect](/what-we-collect). 9 | 10 | DNT stands for Do Not Track. It means that visitors can enable this setting and basically ask the websites they visit to not track them. This is great, but it's not very well supported. The organization behind our internet (W3C) disbanded its DNT working group in January 2018, citing insufficient support and adoption. Apple discontinued support for DNT the following month. 11 | 12 | The [Do Not Track](https://en.wikipedia.org/wiki/Do_Not_Track) setting requests that a web application disables either its tracking or cross-site user tracking of an individual user. [We don't do that ever](/what-we-collect), but by default we do not collect visits from devices that have Do Not Track enabled. By default the data will not include visitors with the Do Not Track enabled. 13 | 14 | To also record DNT visitors you can add `data-collect-dnt="true"` to the script tag: 15 | 16 | 17 | ```html 18 | 19 | ``` 20 | 21 | If you don't add the `data-collect-dnt` attribute we will not record visits from users who have DNT enabled. 22 | 23 | ## Enable collecting DNT visits for noscript.gif pixel 24 | 25 | If you use our [noscript.gif](/without-javascript) to collect page views you can also enable collecting DNT visits. Just append `collect-dnt=true` to the pixel. Read more on [the collect without JavaScript page](/without-javascript). 26 | 27 | If you encounter issues, don't hesitate to contact us via [our support channels](https://simpleanalytics.com/contact). 28 | 29 | ## Legacy 30 | 31 | Before this setting was called `data-skip-dnt`. Although both version will work, we advise you to only use `data-collect-dnt`. 32 | -------------------------------------------------------------------------------- /_docs/20_script-settings/03_hash.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Hash mode 3 | menu: Hash mode # 4 | category: script-settings 5 | permalink: /hash-mode 6 | last_modified_at: 2022-04-14 7 | --- 8 | 9 | Some websites don't really navigate to other pages but us the hash (`#`) in the URL. Normally Simple Analytics removes everything from the URLs after a `?` or a `#`. We don't want to collect this information because it could contain private information like search keywords. 10 | 11 | To allow the script to detect those hash changes you can add `data-mode="hash"` to the script tag: 12 | 13 | 14 | ```html 15 | 16 | ``` 17 | 18 | This way the Simple Analytics script knows it should detect hash changes and records them as page views. We still drop everything after the question mark, but we keep the hash. 19 | 20 | If you encounter issues, don't hesitate to contact us via [our support channels](https://simpleanalytics.com/contact). 21 | -------------------------------------------------------------------------------- /_docs/20_script-settings/03_overwrite-domain.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Overwrite domain name 3 | category: script-settings 4 | permalink: /overwrite-domain-name 5 | last_modified_at: 2025-06-06 6 | --- 7 | 8 | Sometimes you want to link multiple domains into one domain in your dashboard. Or you want to use a different domain than people see in their browser address bar. You can overwrite the default domain name by specifying its hostname. 9 | 10 | > With [custom views](/custom-views) you can keep websites separate **and** combine multiple websites into one view. 11 | 12 | Make sure to include the our `simpleanalyticscdn.com` script (note the **cdn** part). Include these two lines at the end of your ``: 13 | 14 | 15 | ```html 16 | 17 | ``` 18 | 19 | You see that we added an attribute (`data-hostname=""`) to the script tag and `hostname` param to the `img` tag. If you add your domain to it (eg `example.com`) it will look like this: 20 | 21 | 22 | ```html 23 | 24 | ``` 25 | 26 | ## Add overwriting domain to your dashboard 27 | 28 | Now all the visits you collect with this script are collected under the name `example.com`. Make sure you [add the new used domain name](https://simpleanalytics.com/websites/add) (`example.com`) to your dashboard. 29 | 30 | ## Noscript 31 | 32 | If you want to use our