Google Analytics Dashboard API demo not working when implemented - google-analytics-api

I can't seem to get this demo of the Google Analytics embeddable Dashboard working: https://ga-dev-tools.appspot.com/embed-api/third-party-visualizations/
Here is a link to my work area: http://goo.gl/2dfnOX
I copy and pasted all code provided from the sample page, and added the local visualization scripts as required.
Any help would be appreciated.

Related

Image tracking not working with Google Analytics

I'm trying to add Google Analytics to my newsletters - sending via email.
I found img tag logging ( <img src="https://www.google-analytics.com/collect?v=1&utmac=UA-123456789-1&ec=email&ea=open&t=event" /> - https://blog.mailtrap.io/google-analytics-for-emails/ ), but it's not working because of src link is replaced by mail engines (gmail, ymail,..).
Also, I tried to track it by opening on my own web-site: I added img tag on my web-site's main page and loaded many times, but Google Analytics did not report it (logging is working on my Google Analytics account: I've tried to add Google Analytics scripts in head and it was logged - function gtag and its scripts..).
How to use Google Analytics in mails?
Thanks
A lot of browser-based mailboxes will cache the image on their server instead. I don't think there is a way around that.
Regarding why nothing is tracking, in the link you provided as well as documentation from Google requires other parameters as well. You're missing at least the client id cid parameter, adding it should work.
You can verify with the hit builder.

Embed API demo not working

I tried using this Google Analytics Embed API Demo, of course with my own ClientID (49803909):
Embed API Demo
However, instead of the graphic I should be getting, I only get a blank page. I did follow the instructions quite carefully. Does this work for others? Any ideas of what may be wrong?
PS: Here's the screenshot of where I am getting the id from. #DaImTo was right that just 49803909 wasn't it, but I also tried to full long string and even the service id below (the one with #), all to the same effect (a blank screen). So, is this the wrong screen then?
I think #DalmTo is correct. You're most likely using one of the many other Google Analytics IDs instead of using a valid Client ID (which is not Google Analytics-specific, it's a general ID used for accessing Google APIs), and you're probably getting errors logged to the JavaScript console that say something to that affect.
If you follow the steps in this Embed API Developer Guide, you'll see instructions on how to create a Client ID to use with the Embed API.

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?
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
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 )
Browse to your github pages branch - which would be something like - ( https://github.com/YourUserName/YourRepository/tree/gh-pages )
Then edit index.html from listed files
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 )
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.
You will find your Universal Analytics tracking code under Admin > Property > Tracking Info > Tracking Code.
Create a new file called analytics.html in the _includes folder found in your Jekyll website’s directory.
Add Google Analytics Tracking ID code to analytics.html.
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.
If you are using the minima template provide by Jekyll then -
Add google_analytics: UA-xxxxxxxx-x to your _config.yml
Create a file _includes/google-analytics.html and add the google analytics js code in it.
Replace
ga('create', 'UA-xxxxxxxx-x', 'auto');
with
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 - https://github.com/jekyll/minima
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.
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: https://github.com/igrigorik/ga-beacon
Adding analytics via _config.yml.
All GitHub themes (supported themes) natively support google analytics.
You just have to provide a tracking code (UA-XXXXXXXXX-X).
Google analytics comes in two flavours - Google analytics 4 (GA4), and Universal analytics. You will have to use the latter for this. GA4 will not work #.
Create a new Universal google analytics property (and not GA4 property). By default the tracking property you create will be of type GA4. You will have to select "Create a Universal Analytics property" for the property to be universal.
Once a GA4 property is created it cannot be converted to Universal property. You can only do this while creating a new property.
1.1 Turn Universal analytics on in the advanced options.
1.2 Configure Universal analytics options.
1.3 Copy the tracking ID for this newly created property.
Add this tracking ID to your gh-pages sites's _config.yml.
google_analytics: UA-XXXXXXXXX-X
The following is from modernist's readme - the theme I was using for my site.
Commit and Push the changes to github, and after few minutes navigate to your site's URL.
Verify that everything went fine.
If you search the source code now for the tracing ID, you will be able to find it.
Google analytics dashboard too will start showing activity.
The above steps show how to add google analytics to an existing gh-pages site. You can use the same code while creating a new gh-pages site too. Although it seems automatic page generator no longer exists - Can't locate "automatic page generator" button in Github
# Maybe there is a way to use GA4 natively by configuring _config.yml. I wasn't able to do that, and had to resort to universal analytics.
Reference(s)
https://www.analyticsmania.com/post/downgrade-from-google-analytics-4-to-universal-analytics/
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.
I use the README.md file as a source for my GitHub personal page. I also use one of the GitHub supported themes 'cayman'. No more files is required in the repository apart from _config.yml (unless you want to modify your supported theme).
To add Google Analytics, I just followed the advice in the 'cayman' repository (https://github.com/pages-themes/cayman):
Cayman will respect the following variables, if set in your site's _config.yml:
google_analytics: [Your Google Analytics tracking ID]
Full stop! Anything else! Everything works on the side of Google Analytics!
It may be a viable option for those who look for a quick set up of GitHub Pages with Google Analytics.
If you're using an automatically generated github page from your github README.md I found this to be the easiest way:
Just edit your _config.yml to look like this (with your own google analytics UA id):
theme: jekyll-theme-cayman
title: My Site
description: My site description
url: https://example.com
author: MyName
plugins:
- jekyll-seo-tag
google_analytics: UA-xxx
Then add a new file to your repository root named Gemfile with this content:
source "https://rubygems.org”
gem "github-pages", group: :jekyll_plugins
gem 'jekyll-seo-tag'
Then wait a bit and refresh your github page and show page source code. Verify that the SEO plugin has inserted your analytics java script.
More info here: https://github.com/jekyll/jekyll-seo-tag
From the installation instruction, I didn't have to add the {% seo %} in the html, luckily, because I have no html. Github seems to have thought of that.
With me, I was unable to configure Google Analytics 4 (prev Web+App) via adding google_analytics: UA-xxxxxxxx-x to your _config.yml as mentioned previously in one of the answers.
So I had to put the js recommended by the Google Analytics in the .md file.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXXX');
</script>
Anything you put in the script tag in .md will not be rendered.
Include a Global site tag in the html output <head>
Once you setup a Google Analytics account, detailed instructions are included under the "Data Streams" tab- select your data source, and then "Tagging instructions" for Global site tag(gtag.js)
Global site tag
the script will look something like this (with id replaced by XXXXXXXXXXX in my example):
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=XXXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'XXXXXXXXXXX');
</script>
Save the html script within a file in your Project directory (e.g. as "GA_script.html")
Add html file to the header
in the Rmarkdown YAML, add the reference to your specific script (see ref here):
output:
html_document:
includes:
in_header: GA_script.html
This appears to be a bug in Jekyll Minima. See these GitHub issues for reference:
feat: Support GA4 - Google Analytics 4 properties
Google Analytics data not received
Set google_analytics at _config.yml with tracing-id started with UA- rather than G-,tracing-id like G-xxxx is of Google Analytics 4. and Jekyll does not support Google Analytics 4.
Use
google_analytics: UA-xxxxxx-x
Do not use
google_analytics: G-xxxxxx
However,Google Analytics(Universal Analytics) is no longer supported by Google until 2023.7.1.

Facebook open graph tutorial not working correctly and not running without chrome

I was trying the open graph tutorial from Facebook developers site.
http://developers.facebook.com/docs/opengraph/tutorial/
I copied and pasted the code and changed the app ID with mine. Step 2 worked fine, but from step 4 meta tags are not working. I checked the code several times,app ID and "YOUR_NAMESPACE"is changed correctly. I was developing inside localhost of WAMP server. Did I miss anything? I followed every step from the tutorial.
Secondly 'Add to timeline' or 'login' box isn't showing in any browser except chrome. Inside chrome it works fine, but in firefox or IE it shows only a link to Facebook site. Why is that!
And suggest me some good tutorial on open graph.Please Help!
It probably didn't work as it says the object page in Step 4 has to be publicly accessible. Facebook needs to be able to gather data from that page to present in time line. Your localhost mamp install won't be publicly accessible.
From the tutorial >>
Before being able to publish an Open Graph action for a user and having define its
corresponding connected object type in Step 3, you will now need to create a publicly
accessible web page that represents this object using Open Graph metatags. Once this
object page is created, you can use the Graph API to publish an action.
I have not seen any good tutorials on it besides facebook's. They go in depth into every aspect of it as it is their product. I followed that same tutorial and it works perfectly.
Without your code I cant really help. If you put your meta tags up ill have a look.
Im also not sure if it actually works off the local host.

How to get AdSense on a Google Code project page?

I must admit that I don't really know if this is the right place to ask this question, however: in your knowledge it possible to have AdSense on a Google Code project page? I have tried searching Google for information about this, but it gets very confused by the query (that's because the AdSense API is on Google Code as well!).
I found this method that allows you to put ad gadgets with AdSense on your Google Code project home and wiki pages: http://code.google.com/p/gprojecthosting-adsense/
It works very well for me, I must say.
Just keep in mind that the gadget renders in an iframe with little if any content, so the relevant ads as inferred by Google will be mostly (or only) interest-based.
I use this one https://code.google.com/p/gcodeadsense/
works like a charm. Mind this: just use the number from the client code and skip "ca-pub-".