How to add Google Analytics Tracking ID to GitHub Pages

github pages analytics
jekyll/minima google analytics
google analytics github
create a google analytics account
google analytics desktop app
google tracking tool
google analytics marketplace
google analytics products

Could be a simple question but I am full of doubts right now about adding Google Analytics Tracking ID to GitHub page.

I am using GitHub automatic page generator to create my GitHub page but it asks for "Google Analytics Tracking ID". I tried to sign up with Google Analytics but there on it asks for website URL.

Now what I am supposed to do?

One more ques: can we add Google Analytics Tracking ID later on after GitHub Page has been created?

Update: Added steps descriptions for others

Solved it: had to include (link that I want to track) in Google Analytics website section.

you can check GitHub help page here

After that I was provided with an Tracker ID.

Note: You can easily change or add more websites on Google Analytics page from your Google Analytics admin panel.

Update 2: - Adding Google Analytics Tracking ID to Already created Github pages (As requested by @avi-aryan )

  1. Browse to your github pages branch - which would be something like - ( )
  2. Then edit index.html from listed files
  3. Now in within HEAD tag of index.html - paste your Google Analytics Tracking ID Script ( if have already signed up for Google analytics then you can browse it under admin and then tracking info tab )

Adding Google Analytics to GitHub Pages, Login to Google Analytics and create a new property to receive a tracking ID for your website. You will find your Universal Analytics tracking code  Add Google Analytics tracking to an existing static website -

For anyone interested, if you are using Jekyll with GitHub pages, I just wrote a post showing how to correctly add Google Analytics Tracking ID to Jekyll.

  1. You will find your Universal Analytics tracking code under Admin > Property > Tracking Info > Tracking Code.

  2. Create a new file called analytics.html in the _includes folder found in your Jekyll website’s directory.

  3. Add Google Analytics Tracking ID code to analytics.html.

  4. Finally, open _layouts/head.html, and add {% include analytics.html %} just before the end </head> tag. Google recommends this placement to track all of the pages on your website correctly.

Google Analytics for Jekyll, Simply go in Settings from your Google Analytics and create a new property. Copy your Code ID in your header.html on your github pages. Adding Google Analytics to Jekyll and Github Pages sites 1 minute read Introduction. In today’s Internet SEO is one of the most important part of every organization. It can be a deciding factor on what customers are choosing. Today nobody goes to 2nd page in google search results. And there are billions of results for every search query.

If you are using the minima template provide by Jekyll then -

  1. Add google_analytics: UA-xxxxxxxx-x to your _config.yml
  2. Create a file _includes/google-analytics.html and add the google analytics js code in it.


ga('create', 'UA-xxxxxxxx-x', 'auto');


ga('create', '{{ site.google_analytics }}', 'auto');

and you are set!

The google analytics code will now display if your site is built in production environment. For reference see the template's source code here -

You can follow the same approach if you are using a different template by referencing the template's source code and replacing the corresponding files.

Track your website traffic with Google Analytics on github pages , Once you have your property and tracking code you can begin adding the tracking to your jekyll site. Add Tracking to all Pages. The next step is to  Note: Google Analytics is disabled in development mode by default. You can set development option to true to run Google Analytics in development mode. Setup. Add @rabota/google-analytics dependency using yarn or npm to your project; Add @rabota/google-analytics to modules section of nuxt.config.js

Is better to use GA-Beacon for that. GA-Beacon can track all your GitHub repo, even if the visited link isn't an html document.

Please check:

Add Google Analytics to a Jekyll Website, The Google Analytics tracking ID is public, so you can put it in _config.yml without fear. If you worry some hackers corrupt your website data, you  Thanks for this. Nice way to inject the tracking code if serving only static files without a template that includes a header and footer on every page.

You can add Google Analytics to a Jekyll site the same way you would any other site.

First, after setting up your Google Analytics account, navigate to the admin tab.

Next, under the accounts panel, on the left, click: Create New Account.

In Google Analytics, an account represents a set of pages that you would like to track. Set up the website's account as desired.

After your account has been created you will be sent to a page which tells you your Tracking ID and has a JavaScript snippet for you to put on the pages you would like to track. Simply put this snippet in all the pages you would like to track. Or, if you use a default layout put this snippet somewhere in it.

By the way, since you are hosting on GitHub Pages you don't need Google Analytics unless you want very detailed analytics. If all you care about is page views GitHub has this.

Hide Google Analytics ID from My Github Repo · Issue #425 · jekyll , Learn Google Analytics. Why? As a person building a web application, you want to know how people are using your app. The way most web apps track usage is  jekyll_analytics: GoogleAnalytics: # Add, if you want to track with Google Analytics id: UA-123-456 # Required - replace with your tracking id anonymizeIp: false # Optional - Default: false - set to true for anonymized tracking Matomo: # Add, if you want to track with Matomo (former Piwik Analytics) url: # Required - url to

dwyl/learn-google-analytics: A quick guide to learning , However, after adding the tracking ID, the corresponding GH-page still does not render the analytics tag thinking. Here is the link to the  To get your tracking ID, follow these steps: Log in to your Google Analytics account. On the bottom left-hand side of the page, click Admin. From the left column titled Account, select an account from the dropdown menu. From the middle column titled Property, select a property from the dropdown menu.

Issues adding Google-Analytics to the page · Issue #73 , GitHub Pages are public web pages hosted and easily published through GitHub​. The quickest way to get up and running is by using the Jekyll Theme Chooser  To find the Google Analytics ID: Sign in to your Analytics account. Click Admin. Select an account from the menu in the ACCOUNT column. Select a property from the menu in the PROPERTY column. Under PROPERTY, click Tracking Info > Tracking Code. Your Google Analytics ID is displayed at the top of the page.

What's the best way to add Google Analytics to a Github pages site , What I usually do is open up a blank text file and copy and paste both the tracking ID and code in there, to have it handy later. Adding Google  Page view measurement allows you to measure the number of views you had for a particular page on your website. Pages often correspond to an entire HTML document, but they can also represent dynamically loaded content; this is known as "virtual pageviews". This guide explains how to implement page view measurement with analytics.js.

  • Quite a few suggested approaches but I can't get/confirm any of them working yet. I'm hoping it will just start working in 24 hours or so.
  • /Headdesk. I had my Brave browser blocking trackers on my sites. It was working the whole time. Also a confusing thing for me was the (semi) recent move from ga (google analytics) to gtag (google tag). Apparently you only need the gtag() stuff now, no longer the ga() stuff. Fun. These links helped me diagnose my problem:… and
  • @ChrisEmerson that's some useful update :)
  • I had similar issues of my visits not registering, turns out AdBlock was responsible for them.
  • I have added them, however Google analytics say the Tracking is not installed. My page as specified in G-Analytics is
  • @OhadR ohh sorry for that if it didn't helped u
  • FYI: I used the same logic for editing index.html for adding twitter's conversion tracking too. Thanks!
  • @sc28 when did you put analytics on your page? google usually updates the dashboard after quite a while
  • @sc28 no it usually takes a day or two.. check after a day or two
  • Thank you, great post. It's worth noting that within GitHub Pages it is set jekyll.environment == 'production' automatically (, while the Jekyll default environment is 'development'
  • Step 2 is actually not needed. Check the documentation at
  • It works but all my real time data records it came from Ashburn VA. Even when i visit the page locally...very far from VA.