Skip to content

Commit

Permalink
Add documentation regarding the ads.txt file (#2)
Browse files Browse the repository at this point in the history
* Add documentation regarding the `ads.txt` file

* Minor tweak
  • Loading branch information
coatless authored Dec 13, 2023
1 parent 360400e commit 40c90e3
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ filters:
- adsense
```
where `ca-pub-XXXXXXXXXXXXXXXX` in `publisher-id` is your Google Adsense [Publisher ID](https://support.google.com/adsense/answer/105516?hl=en).
where `XXXXXXXXXXXXXXXX` in `publisher-id` is your Google Adsense [Publisher ID](https://support.google.com/adsense/answer/105516?hl=en).

If you wish to disable ads on a specific page, then add to the Quarto document's YAML header area:

Expand All @@ -67,10 +67,44 @@ filters:
---
```

### Google Adsense Setup: Adding `ads.txt`

To ensure smooth integration with Google Adsense, it's essential to create a [standalone file named `ads.txt`](https://support.google.com/adsense/answer/12171612) within your project directory that identifies the domain as being authorized to serve ads. Follow these steps to include the `ads.txt` file:

1. **Create `ads.txt` File:**
In the root of your project, create a new file named `ads.txt`.

2. **Add Google Publisher ID:**
Open `ads.txt` and insert the following line, replacing `XXXXXXXXXXXXXXXX` with your actual [Google Publisher ID](https://support.google.com/adsense/answer/105516?hl=en):

```
google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
```
This line informs Google's web crawler about your association with the provided Publisher ID. For an example, please see the [`docs/ads.txt`](https://github.com/coatless-quarto/adsense/blob/main/README.md).
3. **Save and Include in Version Control:**
Save the changes to `ads.txt` and ensure that the file is included in your version control system if you're using one.
4. **Register `ads.txt` in _quarto.yml:**
Open the `_quarto.yml` configuration and add the `resources` line under the project key.
```yaml
project:
type: website # default, book, revealjs
resources:
- ads.txt
```

This ensures the additional file resources are copied to the output directory.

This step is crucial for validating your ownership of the website and enabling a smooth interaction between your Quarto-generated content and Google Adsense. Remember to replace `XXXXXXXXXXXXXXXX` with your specific Google Publisher ID.

## References

- Google Adsense
- [Google Adsense: Find Publisher ID](https://support.google.com/adsense/answer/105516?hl=en)
- [Google Adsense: Ads.txt guide](https://support.google.com/adsense/answer/12171612)
- [Google Adsense: Get and copy the AdSense code](https://support.google.com/adsense/answer/9274019?hl=en)
- [Google Adsense: Where to place the AdSense code in your HTML](https://support.google.com/adsense/answer/9274516?sjid=14850419192472362507-NC)
- Quarto
Expand Down
1 change: 1 addition & 0 deletions docs/ads.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
33 changes: 33 additions & 0 deletions docs/qgads-installation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,39 @@ To seamlessly integrate the `adsense` extension into your Quarto project, follow

This command installs the `adsense` extension in the `_extensions` subdirectory of your Quarto project. If you're utilizing version control, make sure to include this directory in your repository.

## Google Adsense Setup: Adding `ads.txt`

To ensure smooth integration with Google Adsense, it's essential to create a [standalone file named `ads.txt`](https://support.google.com/adsense/answer/12171612) within your project directory that identifies the domain as being authorized to serve ads. Follow these steps to include your [Google Publisher ID](https://support.google.com/adsense/answer/105516?hl=en):

1. **Create `ads.txt` File:**
In the root of your project, create a new file named `ads.txt`.

2. **Add Google Publisher ID:**
Open `ads.txt` and insert the following line, replacing `XXXXXXXXXXXXXXXX` with your actual Google Publisher ID:

```
google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
```

This line informs Google's web crawler about your association with the provided Publisher ID. For an example, please see the [`docs/ads.txt`](https://github.com/coatless-quarto/adsense/blob/main/README.md).

3. **Save and Include in Version Control:**
Save the changes to `ads.txt` and ensure that the file is included in your version control system if you're using one.

4. **Register `ads.txt` in _quarto.yml:**
Open the `_quarto.yml` configuration and add the `resources` line under the project key.

```yaml
project:
type: website # default, book, revealjs
resources:
- ads.txt
```
This ensures the additional file resources are copied to the output directory.
This step is crucial for validating your ownership of the website and enabling a smooth interaction between your Quarto-generated content and Google Adsense. Remember to replace `XXXXXXXXXXXXXXXX` with your specific Google Publisher ID.

## Usage

You can configure the `adsense` extension in either of the following ways:
Expand Down
7 changes: 7 additions & 0 deletions docs/qgads-release-notes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ format:
toc: true
---


# 2.1.0-Dev: ??? (??-??-??) [DEV]

## Documentation

- Added documentation to both the README and Installation guide detailing the setup process of `ads.txt`. ([#1](https://github.com/coatless-quarto/adsense/issues/1), h/t [@JosiahParry](https://github.com/JosiahParry))

# 2.0.0: Selective Monetize (12-06-2023)

## Features
Expand Down

0 comments on commit 40c90e3

Please sign in to comment.