Skip to content

Commit

Permalink
replace async defer by defer for <script> + misc linter (#96)
Browse files Browse the repository at this point in the history
* replace `async defer` by `defer` for <script> + misc linter

* Revert some change as requested in
#96 (review)
  • Loading branch information
divinerites authored Jun 7, 2021
1 parent c0a0f0f commit 51125c9
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions docs/404-error-pages-tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If you use the 404 error pages tracking feature, then these count towards your b
Tracking 404 error pages is essential for many site owners and Plausible helps you automate this process. With our "**404 Error Pages Tracking**" you can:

* Get an easy overview of which 404 pages are accessed by your visitors
* See where visitors find broken links to your 404 error pages
* See where visitors find broken links to your 404 error pages
* Then you can manually fix broken links and redirect error pages

If you want to track 404 error pages on your site, here's what you need to do:
Expand All @@ -23,7 +23,7 @@ If you want to track 404 error pages on your site, here's what you need to do:
First, make sure your tracking setup for Plausible Analytics includes the second line as shown below:

```html
<script async defer data-domain="<yourdomain.com>" src="https://plausible.io/js/plausible.js"></script>
<script defer data-domain="<yourdomain.com>" src="https://plausible.io/js/plausible.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
```

Expand Down
6 changes: 3 additions & 3 deletions docs/carrd-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
You can add Plausible Analytics tracking code to your Carrd website by adding an "**Embed**" component. Carrd is a one-page website builder that doesn't support normal navigation. You need to use [our special hash-based script](hash-based-routing.md) on Carrd sites.

* Go to the editor of your Carrd website and add an "**Embed**" component.
* Change the type to "**Code**" and give it any name that you want.

* Change the type to "**Code**" and give it any name that you want.

* Paste your Plausible Analytics hash-based script tag into the "**Code**" field.

* Here's what the full script tag will look like (make sure to replace your-domain with the domain you've added to Plausible Analytics):

```html
<script async defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.hash.js"></script>
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.hash.js"></script>
```

* After adding your code, click on the "**Save**" button.
Expand Down
10 changes: 5 additions & 5 deletions docs/custom-domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Serve the script from your domain as a first-party connection

import useBaseUrl from '@docusaurus/useBaseUrl';

:::note
:::note
Custom domains are depreciated. They still work but we recommend those who use the custom domain to proxy the script instead. New to Plausible? Use the proxy instead of the custom domain. [Here are the proxy instructions](/proxy/introduction.md)
:::

Expand All @@ -22,7 +22,7 @@ We recommend using a subdomain of the website you're running Plausible Analytics

Next, you need to go to your DNS provider’s website and create a new CNAME record for your chosen subdomain. Please check with your DNS provider's documentation on how you can create a new CNAME record.

Point the CNAME record to `custom.plausible.io.` (including the last dot) and then click on the "**Done**" button on the Plausible Analytics website.
Point the CNAME record to `custom.plausible.io.` (including the last dot) and then click on the "**Done**" button on the Plausible Analytics website.

:::note
Some domain registrars such as GoDaddy don't accept CNAME values with a dot at the end while others require it. If your registrar doesn't accept your CNAME records, please delete the dot at the end and try again.
Expand All @@ -41,7 +41,7 @@ The setup is completed and ready to use when your subdomain loads our JavaScript
Don't worry if your subdomain (`yoursubdomain.yourdomain.com`) shows a 404 error. That's expected behaviour. The important part is that the script itself loads from your subdomain (`yoursubdomain.yourdomain.com/js/index.js`). That's when you can replace the snippet on your site.

:::note
Do you have a wildcard SSL configuration, so your subdomains automatically get the SSL certificate? Please disable it for the subdomain you want to serve Plausible script from. We will automatically get the SSL certificate from Let's Encrypt for your subdomain.
Do you have a wildcard SSL configuration, so your subdomains automatically get the SSL certificate? Please disable it for the subdomain you want to serve Plausible script from. We will automatically get the SSL certificate from Let's Encrypt for your subdomain.
:::

:::note
Expand All @@ -53,7 +53,7 @@ Using Cloudflare for DNS and having your sites proxied behind Cloudflare? A prox
When our JavaScript file loads from your subdomain, you can finish your setup by replacing the tracking code on your site with something that looks like the following code (your custom code will be shown on the confirmation page):

```html
<script async defer data-domain="yourdomain.com" src="https://yoursubdomain.yourdomain.com/js/index.js"></script>
<script defer data-domain="yourdomain.com" src="https://yoursubdomain.yourdomain.com/js/index.js"></script>
```

<img alt="Update the tracking code on your site" src={useBaseUrl('img/update-javascript-snippet.png')} />
Expand All @@ -64,7 +64,7 @@ Using CSP? Do not forget to add this new subdomain specifically to your Content

## Should I create a custom domain for each of the sites that I want to track?

This is not necessary. You could use one custom domain for all your sites.
This is not necessary. You could use one custom domain for all your sites.

This is convenient if you're running several sites as subdomains. In that case you could create plausible.yourdomain.com as your custom domain and use that for all the different subdomains you have as part of yourdomain.com (subdomain1.yourdomain.com, subdomain2.yourdomain.com etc).

Expand Down
6 changes: 3 additions & 3 deletions docs/custom-event-goals.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you want to track custom event goals like button clicks or form completions,
First, make sure your tracking setup includes the second line as shown below

```html
<script async defer data-domain="<yourdomain.com>" src="https://plausible.io/js/plausible.js"></script>
<script defer data-domain="<yourdomain.com>" src="https://plausible.io/js/plausible.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
```

Expand Down Expand Up @@ -71,7 +71,7 @@ Next, click on the "**Add goal**" button and you’ll be taken back to the Goals

## Using custom props

Custom properties can be attached to events to capture dynamic elements and to further break down goal conversions. You can use custom properties to create your custom metrics to collect and analyze data that Plausible doesn’t automatically track.
Custom properties can be attached to events to capture dynamic elements and to further break down goal conversions. You can use custom properties to create your custom metrics to collect and analyze data that Plausible doesn’t automatically track.

You can then filter and sort your goals by custom event properties in your Plausible dashboard. For those coming from Google Analytics, custom properties are roughly the same concept as _custom dimensions_ in GA.

Expand All @@ -91,7 +91,7 @@ Want to have multiple custom properties for the same event? You can do it like t
plausible('Download', {props: {method: 'HTTP', Region: 'Europe'}})
```

The number of custom properties you can add per event is unlimited. And the names can be anything that you want. In our example, there are 4 properties that have been set up for segmenting: `Version, Region, OS, Method`.
The number of custom properties you can add per event is unlimited. And the names can be anything that you want. In our example, there are 4 properties that have been set up for segmenting: `Version, Region, OS, Method`.

Custom properties only accepts scalar values such as strings, numbers and booleans. Data structures such as objects, arrays etc. are not accepted.

Expand Down
6 changes: 3 additions & 3 deletions docs/discourse-integration.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
title: How to add the script to your Discourse community
title: How to add the script to your Discourse community
---

import useBaseUrl from '@docusaurus/useBaseUrl';

You can add Plausible Analytics tracking code to your Discourse community by adding a "**Theme**" component. You need to use [our special hash-based script](hash-based-routing.md) on Discourse forums.

* Go to Admin > Customize > Themes in your Discourse admin to create a new "**Theme**" component.
* Go to Admin > Customize > Themes in your Discourse admin to create a new "**Theme**" component.

* Paste your Plausible Analytics hash-based script tag into the `<head>` section.

* Here's what the full script tag will look like (make sure to replace your-domain with the domain you've added to Plausible Analytics):

```html
<script async defer data-domain="<your-domain>" src="https://plausible.io/js/plausible.hash.js"></script>
<script defer data-domain="<your-domain>" src="https://plausible.io/js/plausible.hash.js"></script>
```

* If you're using [a custom domain](custom-domain.md) for your Plausible account, you can add the `.hash.js` as follows: `https://your.custom-domain.com/js/index.hash.js`
Expand Down
10 changes: 5 additions & 5 deletions docs/excluding-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Exclude specific pages from being tracked

import useBaseUrl from '@docusaurus/useBaseUrl';

By default, Plausible Analytics tracks every page you install the snippet on. If you don't want Plausible to track specific pages, do not include the snippet on those pages.
By default, Plausible Analytics tracks every page you install the snippet on. If you don't want Plausible to track specific pages, do not include the snippet on those pages.

Alternatively, you can also manually exclude specific pages from being tracked. When excluding pages manually, the exclusion means that pageviews on the excluded page won't be counted any more from the moment of exclusion. The historical stats will be kept and will stay the same.

Expand All @@ -19,7 +19,7 @@ To manually exclude specific pages from being tracked, you need to change your P
The new snippet will look like this (make sure to change the `data-domain` attribute to the domain you added to your Plausible account):

```html
<script async defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.exclusions.js"></script>
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.exclusions.js"></script>
```

## 2. Add the pages you'd like to exclude from being tracked
Expand All @@ -44,17 +44,17 @@ See below for examples of common page use cases and how they would function.
The new snippet would look like this (make sure to change the `data-domain` attribute to the domain you added to your Plausible account):

```html
<script async defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.exclusions.js" data-exclude="/blog4, /rule/*, /how-to-*, /*/admin, /*/priv/*, /more-paths-here"></script>
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.exclusions.js" data-exclude="/blog4, /rule/*, /how-to-*, /*/admin, /*/priv/*, /more-paths-here"></script>
```

You need to place your new Plausible Analytics tracking script code into the Header (`<head>`) section of your site. Place the tracking script within the `<head> … </head>` tags. Do this for all the websites where you'd like to use page-tracking exclusions.
You need to place your new Plausible Analytics tracking script code into the Header (`<head>`) section of your site. Place the tracking script within the `<head> … </head>` tags. Do this for all the websites where you'd like to use page-tracking exclusions.

This is the only tracking script you need. You don't need to keep the default script. Your stats will keep tracking without interruption and you will not lose any of your old data.

You do not have to use the `exclusions` script type exclusively. You can chain various script types, for example:

```html
<script async defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.hash.exclusions.outbound-links.js" data-exclude="/blog4, /rule/*, /how-to-*, /*/admin, /*/priv/*, /more-paths-here"></script>
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.hash.exclusions.outbound-links.js" data-exclude="/blog4, /rule/*, /how-to-*, /*/admin, /*/priv/*, /more-paths-here"></script>
```

The example above includes both [outbound link clicks tracking](outbound-link-click-tracking.md) and tracking for [hash-based routing pages](hash-based-routing.md) in addition to the `exclusions` script type.
Expand Down
2 changes: 1 addition & 1 deletion docs/hash-based-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the default `https://plausible.io/js/plausible.js`.
Here's what the full script tag will look like:

```html
<script async defer data-domain="<your-domain>" src="https://plausible.io/js/plausible.hash.js"></script>
<script defer data-domain="<your-domain>" src="https://plausible.io/js/plausible.hash.js"></script>
```

If you're using a custom domain, you can add the `.hash.js` as follows: `https://your.custom-domain.com/js/index.hash.js`
Expand Down
8 changes: 4 additions & 4 deletions docs/internal-link-click-tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Goals make it easy to track internal link clicks. Here's how you can set it up:
First, make sure to add the second line as shown below to the tracking snippet in the `<head>` section of your site:

```html
<script async defer data-domain="<yourdomain.com>" src="https://plausible.io/js/plausible.js"></script>
<script defer data-domain="<yourdomain.com>" src="https://plausible.io/js/plausible.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
```

Expand All @@ -29,7 +29,7 @@ Here's an example of HTML that tracks all the clicks on a link with the goal nam
<a href="/about" onclick="plausible('About Us')">learn more about us</a>
```

And you can use our custom properties to split different clicks. For instance if you have two different links to your about page, you can see which of these makes a bigger difference and gets more clicks.
And you can use our custom properties to split different clicks. For instance if you have two different links to your about page, you can see which of these makes a bigger difference and gets more clicks.

Here's an example of HTML that tracks all the clicks with the goal name being "**About Us**" and the clicks from the "**Header Menu**":

Expand All @@ -55,15 +55,15 @@ To configure a goal, go to your website’s settings in your Plausible Analytics

Click on the "**+ Add goal**" button to go to the goal creation form.

Select `Custom event` as the goal trigger and enter the name of the custom event you are triggering.
Select `Custom event` as the goal trigger and enter the name of the custom event you are triggering.

The names must be an exact match to the one in your HTML code for the conversions to show up in your analytics dashboard (in the example above the goal name would be "**About Us**").

You don't need to add all the custom properties themselves (header menu and footer menu in the example above). They will show up in your dashboard automatically as long as you've added the main goal name ("**About Us**" in this example).

<img alt="Add your custom event goal" src={useBaseUrl('img/internal-link-click-tracking.png')} />

Next, click on the "**Add goal**" button and you’ll be taken back to the Goals page.
Next, click on the "**Add goal**" button and you’ll be taken back to the Goals page.

When you navigate back to your Plausible Analytics dashboard, you should see the number of visitors who triggered the custom event by clicking on the link you're tracking. Goal conversions are listed at the very bottom of the dashboard.

Expand Down
2 changes: 1 addition & 1 deletion docs/javascript-snippet.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To integrate your website with Plausible Analytics, you need to be able to updat
Your Plausible Analytics tracking script code will look something like this (your exact code will be shown on the JavaScript snippet page):

```html
<script async defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.js"></script>
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.js"></script>
```

## Find your JavaScript snippet
Expand Down
4 changes: 2 additions & 2 deletions docs/outbound-link-click-tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Change your Plausible script snippet `src` attribute from `https://plausible.io/
The new snippet will look like this (make sure to change the `data-domain` attribute to the domain you added to Plausible):

```html
<script async defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.outbound-links.js"></script>
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/plausible.outbound-links.js"></script>
```

As usual, you need to place your Plausible Analytics tracking script code into the Header (`<head>`) section of your site. Place the tracking script within the `<head> … </head>` tags.
Expand Down Expand Up @@ -59,7 +59,7 @@ Click on "**Outbound Link: Click**" to see the full list of all clicks on all ex
* The conversion rate
* Top referral sources that lead to clicks
* Top pages that drive the clicks
* Countries that click on external links
* Countries that click on external links
* Devices (screen size, browser, OS) that click on external links

Click on a particular external URL to filter the dashboard by those clicks only and get the full overview of that specific URL.
Loading

0 comments on commit 51125c9

Please sign in to comment.