Google AdSense is a free, simple way to earn money by placing third-party advertisements on a website. My Github hosted Jekyll website is being used primarily as a blog as you can see, so I wanted to host an advertisement at the end of each blog post, just above the comments section.

Now, step by step guide.

Step 1. Sign up

First of all, you need a Google AdSense account. If you have a primary Google account that you use for other services like Gmail, Google Drive, Google+, or YouTube, then you should set up your Google AdSense using that Google account. Or you will need to create a new one.

Sign up for Google AdSense using the following link: Google AdSense

Step 2. Create the ad unit

To generate your AdSense ad code you first need to create the ad unit. You can do this on the My ads tab in your AdSense account.

Ad unit - is set of Google ads displayed as a result of one piece of AdSense ad code. There are a few different types of ad unit that you can choose from.

Step 3. Get the ad code

You can find the button called code on the bottom of your ad unit.

Your ad code will be similar to the following one:

<script async src="//"></script>
<!-- Single post - 1 ( -->
<ins class="adsbygoogle"
    (adsbygoogle = window.adsbygoogle || []).push({});

Note: This is sample code only, please don’t use it on your own website.

Step 4. Create the template with your ad code

Create a file called advertisements.html in the _includes catalogue of your Jekyll website. Insert your ad code to this file.

Step 5. Call the advertisements template from a post template

Go into the _layouts catalogue and find the post.html file (or any layout file for which you would like ads displayed) and insert the following code.

{% include advertisements.html %}

I place this right after the {{ content }}, but the placements is totally up to you. In my case an ads will be displayed at the end of each blog post, just above the comments section.

You just need to wait a few days and then you should recieve an ads on all pages that utilise that layout.

Each month, you can have the money deposited directly into your bank account or mailed to you as a check. By the way, Google only mails you a check after you accumulate $100 worth of revenue.

Note: To see the ads by Google AdSense running on your website, remember to temporary disable your adblocker.

Arthur Gareginyan
Arthur Gareginyan

Arthur is a designer and full stack software engineer. He is the founder of SpaceX-Chimp and the blog His personal website can be found at

Follow Arthur: