Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Saturday, April 23, 2016

How to add Google Analytics Tracking ID to GitHub Pages

How to add Google Analytics Tracking ID to GitHub Pages


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.

Answer by exexzian for How to add Google Analytics Tracking ID to GitHub Pages


Update: Added steps descriptions for others

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

you can check GitHub help page here


enter image description 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 -
    ( https://github.com/YourUserName/YourRepository/tree/gh-pages )
  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 )

Answer by omouse for How to add Google Analytics Tracking ID to GitHub Pages


To add Google Analytics tracking id to existing pages you don't need to add the tracking javascript code to the index.html. You only have to modify params.json in the root directory of the gh-pages branch.

params.json

{    "name":"Datastream.github.com",   
"tagline":"my personal blog docs", "body":"some text goes here", "google":"", "note":"Don't delete this file! It's used internally to help with page regeneration." }

You will want to set the "google" field to whatever your Google Analytics id is (it starts with UA-)

Answer by caffinatedmonkey for How to add Google Analytics Tracking ID to GitHub Pages


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.

navbar

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

add 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.

Answer by user4011964 for How to add Google Analytics Tracking ID to GitHub Pages


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

Please check: https://github.com/igrigorik/ga-beacon

Regards

Answer by Colin for How to add Google Analytics Tracking ID to GitHub Pages


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 tag. Google recommends this placement to track all of the pages on your website correctly.


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

Related Posts:

0 comments:

Post a Comment

Popular Posts

Fun Page

Powered by Blogger.