Google's own demo of their Analytics API forbidden by SAMEORIGIN - google-analytics

I'm just getting started looking at the Google Analytics API which should allow me to embed some Analytics data into a page. I have found two pages containing almost identical demo code, both created by Google themselves:
https://ga-dev-tools.appspot.com/embed-api/basic-dashboard/
https://developers.google.com/analytics/devguides/reporting/embed/v1/devguide
and neither of them works. Nothing loads, and the error message in the Console is:
Refused to display 'https://accounts.google.com/o/oauth2/auth?client_id=MY_CLIENT_ID&origin=MY_URL&state=1729197785%7C0.713338618&authuser=0' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
Can anyone explain why this would be? The Client ID isn't the problem, I've double-checked, and there are no restrictions on referrers. This happens when the code is place in a live public web page, not locally on an intranet or localhost page.

Related

How to set up cross-domain tracking in GA4?

How to set up cross-domain tracking in GA4 right?
I followed official instructions: [GA4] Set up cross-domain measurement
I've added all the domains I need to the Date Stream Details - More Tagging Settings - Configure your Domains.
Added 'Google Analytics: GA4 Configuration' tag on the website using Google Tag Manager.
But now, when switching between domains, a lengthy parameter
(smth like "?_gl=11lop9ld*_gaNDcxNTp2McYzKjE2LTcxMjQwKLv._ga_3JP1WO1NB3MTYxNzEyNDA4Ny8xLjEuKOPxNzEyNLI5Ny40Nw..")
is added to the page address and the page does not open, a 404 error appears.
What could be the problem?
As #Tony McCreath said, It might be a problem on the website's end on handling unexpected query parameters. I already faced this problem while working on a client website, and there was nothing that could be done on the Analytics side to fix the issue. You can test if that's the case by adding any random parameters at the end of the URL to see if the website still works.
The lengthy parameter that is added to the URL is the way Google uses to identify that a user is coming from another domain. It's basically an ID that will link the user from the previous domain to the current one.

Why is the change from HTTP to HTTPS in View Settings within Google Analytics important?

I have an HTTPS site which runs on SSL since years, also the Google Search Console is configured with HTTPS. If you lookup a page of that site through HTTP, a redirect to HTTPS will take place.
Now I found out, that within Google Analytics > View Settings, the property Website's URL ist still configured with HTTP (in that dropdown menu there). But in Google Analytics > Property Settings, it's correctly configured with HTTPS.
As I don't want to create a negative impact on any data collected within the last 10 years, would the property change have an impact on the data? Why is it important that this property is actually on the currently used protocol? Because data is collected, everything is actually there, so why should I need to change it?
Thanks
That setting has no impact on data. It doesn't change automatically, you have to be the one to set it. It is used, for example, to preview the page by clicking on the icon in the page report.

Filtering out ghost traffic from Google Analytics

Recently I've been experiencing a large amount of (what I think is) ghost traffic.
I need help in creating a filter to exclude this traffic from my Google Analytics.
URL's are showing up that have other websites appended to them.
Almost all articles I've read mention including only relevant hostnames but this doesn't seem to apply to my situation.
Here you can see the URL's with other random website addresses.(overworlf.com/evite.com/shmoop.com and many others)
Here is a screenshot of the hostnames none of them are out of the ordinary. I suspect this ghost traffic is using my main domain looking at the huge amount of users.
Posted the same question at stackexchange, someone there was able to help me
https://webmasters.stackexchange.com/a/118666/94264
"Almost all the analytics spammers insert data into your stats by pinging the GA tracker directly with fake data. They never visit your site and they usually just guess at the tracking id without knowing website host name associated with it. They won't send a host name, so it wouldn't appear in that report. See How to fight off Google Analytics referrer spammers?
That appears not be the case here. In this case these appear to be actual hits to your website. I tried one of those "top active pages" and it gives a 404 error. It looks like your 404 template has the GA tricking snippet installed on it. I don't think that is best practice. You could try taking the snippet off your 404 page. Then if you did get actual hits to such URLs, GA wouldn't count them as pages."
This can happen when there are search and replace or advanced filters. Are there filters on your view that alter the Request URI?
EDITED AFTER IT WAS CONFIRMED THAT THERE WERE NO FILTERS:
Typically, tracking 404 pages is best practice (referring to your other post).
I don't believe that removing the tracking from that page will help anyway. Like the other poster mentioned, these hits are sent from bots most of the time and they never actually land on your site. The hit is sent directly to your property with an http call. It bypasses the site completely, so whether there is a 404 page or not, the hit will show up in GA.
Adding an exclusion filter to exclude traffic with a page path (not hostname) ending in ".com"

Google Analytics only showing active MOBILE users?

When I go to my site on mobile it almost instantly shows up as an active user on google analytics. But when I do so on PC it never shows up as an active user. Even tried going to the site through Rabb.it
Also it shows active users 1 but "no data has been received the last 48 hours", does it just take time to update?
Have you looked at the JS debugger on your PC browser? Maybe there is an error that is causing the script to load incorrectly?
I've seen Firefox block the actual HTTP request to the analytics tracker, for example if you have private browsing turned on. I would start with using either Chrome's Developer tools or Firefox in conjunction with Firebug to try to take a peek under the covers as to what is occurring, i.e.
Verify that the JS actually loads correctly
Check for debug errors on the JS console
Check to see if the HTTP request is actually going through.
If your browser is blocking it you will see something like the image below.

Is there a way to track/record via Google Analytics visitors that visit my site via Flipboard?

I've been sniffing through my Apache log files and noticed hits which mention
FlipboardProxy/1.1; +http://flipboard.com/browserproxy
Is there a way to track/ID these users via Google Analytics so that I can understand what percentage of my visits are via Flipboard?
From what i read on flipboard:
Flipboard uses a proxy service to fetch, validate, and prepare certain
elements of websites for presentation through the Flipboard
Application.
Retrieving parts of your website to present it in flipboar, they are not actually real visits to your site.
But if you still want to track those requests in analytics then you would need to write a php that sniffs user agent and trigger a gif request to analytics.
IF they're not showing up in the Browser & OS Report; they're probably not running javascript and/or block GA.
Something along those lines might end up here. Right now it shows data at a snapshot only though.
http://ripl.io/flipboard-analytics/

Resources