Pre-Requisites

Before integrating google analytics and google search console to the jekyll project, a google account is needed (basically a google email address).

It is recommended to use single google account for both google analytics and search console to have an easy switch.

There are two version of google analytics available on the market

a single click on any page url is considered as single event. GA free tier threshold is based on events. 

GA4 vs GA360

  1. GA4 (free version of google analytics), free (without hidden) cost with limited number of parameter (max 25 parameter) and event (10 mio per month or +- 300K event per day). More than enough for medium to small blog.
  2. GA360 (enterprise version), paid version, can handle more than millions events per day and hundreds of custom matrix.

— a million of event/click(on the site) per day is already considered as an enterprise. While a small-medium blog with only 1K event per day is already considered a win.

Integration to Jekyll

Below are the step by step to integrate both google analytics and google search console to jekyll projects.

Integrate Google Analytics to Jekyll

Assuming the pre-requisites has been met (having a google account). First step is to create a property on google analytics.

property is a website in google analytics terms. If there will be two website to be integrated, each of it will be a property.

Create New Google Analytics Property

Login to google analytics platform

https://analytics.google.com/

navigate to the bottom left of the page and click the “cog” icon (settings)

postimage80 Click on the cog icon to be redirected to the admin page

click on create the button located on top of the admin page and choose property.

postimage80 Create new google analytics property

enter the website/blog name, following property name will be used on this article

property: playpumpkin

once the property name is specified click next.

postimage80 Specify the property name

set the property category

postimage80 Playpumpkin is game focused blog, hence it is games industry

it is recommended set business objectives to understand web and or app traffic to avoid any neccesary insight as the main purpose of google analytics for playpumpkin is to monitor the user traffic and behavior

postimage80 Set business objective to understand traffic

Add Javascript code to the jekyll project

choose “web” as the platform as jekyll is web based framework / SSG (static site generation).

postimage80 Jekyll is SSG framework, choose it as the platform

enter the website url.

note: ensure the blog alraedy has FQDN (fully qualified domain name) and HTTPS ready (require SSL certificate)

and also make sure www is redirected to non wwww (or vice versa, depend on the preferences) to avoid canonical issue later during the google search console setup.

postimage80 Input blog url, require https and http on the FQDN

once the stream is created, click next

postimage80 Stream is created

add the javascript code on the blog. recommended way to put the google analytics java script code on the footer.

ensure the script only accessed during on production environment. otherwise it will add false positive information on the visitor count/insight.


on the jekyll deployment pipeline configuration, add environment variable called as “environment” and set the value to production.

then create a jekyll condition check liquid syntax to only activate the google analytics javascript if the environment variable is set production.

No Env Variable Name Value
1 JEKYLL_ENV production

postimage80 JEKYLL_ENV set to production

following is sample code for playpumpkin

postimage80 Google tag id unique per property and FQDN


<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-QSFKWHCQSF"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-QSFKWHCQSF');
</script>

done, now deploy the jekyll project to reflect the changes regarding google analytics.


Test if google analytics is integrated successfully.

once the deployment is completed, click the test installation button on google analytics.

also its recommended to access the webiste and see if google analytics able to detect it.

postimage80 Test if google analytics can monitor the website

if the installation is successfull (it may take time), number of visitor on the google analytics report page will be increased.

postimage80 Website if successfully integrated to the google analytics as it can already detect the number of visitor

Integrate to Google Search Console

Google search console is used to monitor the website performance on the search engine. It could monitor the keyword associated with the property.

go to below url to access google search console.

https://search.google.com/search-console

enter the FQRN (without HTTP or HTTPS) as shown below

postimage80 enter the website domain name

Validate the domain ownership

there are four ways to confirm the domain ownership status, the recommended way is to use DNS record.

select the record type as TXT

postimage80 Use TXT to validate the domain ownership

Go to the domain provider and create new TXT record and paste the value. For this article the domain provider is AWS Route 53.

postimage80 add new DNS record with type TXT

once the DNS record has been added, click verify button on the google search console.

postimage80 Click the button to start domain ownership verification

if the verification is success, a pop up message will appear indicating the property registration on google search console is completed.

postimage80 Property verification is compeleted on google search console

done.

Add sitemap

to speedup the crawling process, it is recommended to add sitemap.xml path url on the google search console.

postimage80 Google search now will utilize the sitemap.xml during the crawling process. All the url mentioned on the xml will be crawler eventhough not guarantee the indexability

go to search console property , navigate to the sitemaps and add url xml url.

Next Step

Now that both of googel search console and google analytics has been in plcaed, adding more quality content is the next priority.

— quality = unqiueness, the depth of content and completeness of the content.