Why can't I get the full URL from a Google search - javascript

I search Google for a phrase which brings up my website.
Google shows a URL similar to
https://www.google.co.uk/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=my%20search
This brings up my website. On the landing page of my website, I have the following javascript
alert(document.referral);
This shows me the value
https://www.google.co.uk/
No querystring!
Research suggests the issue is likely due to my website being HTTP but both Google and my website use HTTPS
Why can I not get the search phrase from the query string?
Edit
Based upon the links I've been provided (thanks) I can see what you are claiming the issue is. Google doesn't allow it! However, I'm not sure I agree with this - there are many web analytical programs which provide this information. The company I have used (which admittedly can only provide keywords for 5% of all visitors) can do this... And I only embed some javascript. I can only assume it's because visitors can home HTTP:://google as opposed to HTTPS::google

have a look at this document: http://blogs.adobe.com/digitalmarketing/analytics/the-impact-of-google-encrypted-search/
It apparently has something to do with google running HTTPS. on my local tomcat server running HTTP, i get
http://servername/tools/errorlog.jsp?env=Prod&logType=EXTAUTHLOG when running
alert(document.referrer) in a console
Duplicate of:
How can I get the correct referer via JavaScript if the referrer uses https? ??

Related

Is there a way to allow Google OAuth on dynamic URLs?

I'm trying to write a chrome extension that runs on every page of a website (think Reddit, YouTube, etc.)
I can inject my chrome extension into these pages fine but I cannot get the Google Sign In button to work since, obviously, dynamic URLs are not allowed by Google.
Is there a way to have my log in button redirect to a static domain that's known by Google OAuth so that authentication is successful and then somehow send the resulting BasicProfile back to the original application?
Alternatively, is there an easier way to get this information? All I want is the basic information(name, imageURL).
For reference, I am using React in my project and I currently have my sign in button set up with react-google-login.
Thank you so much in advance!

Google one tap login noCredentialsAvailable [duplicate]

I assume it has something to do with this:
For me Google one Tap stopped working on all my sites that previously worked. I added API HTTP refer to restriction in console.developer.com, but I still get a warning message "The client origin is not permitted to use this API." any thoughts? If you go to the page https://www.wego.com/ you can see that Google one tap still works...
https://news.ycombinator.com/item?id=17044518#17045809
but Google YOLO stop working for everyone. I use it like many people for login and it just stop work.
My domain are obviously added on console.developers.google.com
Any ETA for fix this? Some information would be great for people who rely on it.
Google YOLO is not disabled. It is open to a small list of Google Partners.
The reason you were able to access it earlier was because it was open for a short period of time but the whitelist is now readded/enabled.
Reference:
https://twitter.com/sirdarckcat/status/994867137704587264
Google YOLO was put on whitelist after a client-side exploit became clear to google.
People could cover the login button of the prompt with something like a cookie consent (which we all know people automatically accept).
Therefor people could easily steal their gmail or other details due to this google decided to put it on whitelist and review the sites that are using this technology in order to ensure that they are using it as they should.
Google retroactively labeled One-Tap as a "closed beta".
https://developers.google.com/identity/one-tap/web
The beta test program for this API is currently closed. We are improving the API's cross-browser functionality and will provide updates here in the coming months.
The link for the entire project is currently 404, but the beta statement is visible on the wayback machine.

Google api key not working [duplicate]

I am developing in JavaScript/HTML/CSS an app that uses Google Maps. I am getting the following alert dialog box:
"This page was unable to display a Google Maps element. The provided Google API key is invalid or this site is not authorized to use it. Error Code: InvalidKeyOrUnauthorizedURLMapError"
The app does actually display the map element; the alert is not a problem except it should not appear at all. The map displays properly.
I have gone in to the Google Developer's Console and, in the "Credentials" section, have "edited allowed referrers" to be mydomain.com/*
I have also gone in to the Google Developer's Console in the APIs section and enabled 11 Google Maps APIs.
After lots of referrer combinations, deleting and re-creating credentials i realized that i didn't enabled "Google Maps JavaScript API". What a shame. :)
For anyone who is having trouble to get google maps api work please check if the API enabled first.
After struggling a lot with this issue I've found 1 solution for me. It might help people who are searching for a proper and exact solution but not the comments, downvotes and links.
(Map was not displayed in my case.)
If suppose,the link of page where you are loading map is
http://example.com/abc/def/ghi/kpn.php
then give thesame(exactly the same) under Edit allowed references
If you try loading the same page using:
www.example.com/abc/def/ghi/kpn.php
or
http://www.example.com/abc/def/ghi/kpn.php
then your page is loaded but not your map, and this alert is generated.
CONCLUSION
Use the same path(Url address) at these 2 places.
While loading the page which has map.
Under Edit allowed references.
After following this I've got rid from this alert.
First you need to go to https://console.developers.google.com/ and select APIs.
In Google Maps APIs select Google Maps JavaScript API and make sure you enable API for Google Maps JavaScript.
Secondly, you need to create an API key:
Go to Credentials
Create new key and select Browser Key
No need to specify any referrers
So you should see Any referrer allowed after you save.
After a lot of trial and error this worked for me (by Eduardo. Thanks !)
The URL that needs to be authorized is the one in the Referrer header for the requests the browser sends to Google to load the API.
Under Browser Credentials > REFERERS
Add these
.example.org/
www.example.org/*
http://www.example.org
http://example.org
geocodezip provided the info i needed. I was indeed loading the googlemaps library twice: once in my index.html file and once in an iFrame. I changed my code so that the iFrame did not load the googlemaps library but, instead, used the parent. Thanks geocodezip!
Go to APIs menu and find "Google Maps JavaScript API" after you open it just press "Enable API"
I was able to get this to work by deleting all my referrers and allowing all. Apparently there is a bug in the developer console that is causing problems. Some people say that they can get referrers to work by deleting all then adding all back in at once instead of line by line:
https://productforums.google.com/forum/#!topic/maps/mSVyDazRMQo
Previous things I tried:
Regenerating Key
Setting all maps apis to enabled
Hard coding absolute paths of referrers
A side note, when I didn't include my api_key everything worked fined, though I'm sure they will eventually turn you off if you don't use your api_key.
What worked for me was to use Firebug in order to find the exact URL that made the request to the Google Maps API. As stated in Google Maps API documentation on troubleshooting authorization, "How to find the correct URL" part:
The URL that needs to be authorized is the one in the Referrer header
for the requests the browser sends to Google to load the API.
In my case, lets suppose I have a website example.com. In the developer console, under Google Maps API key, I've added many combinations of referrer such as example.com/*, *.example.com/*, example.com, but still the InvalidKeyOrUnauthorizedURLMapError persisted.
My solution, as I've mentioned, to use Firebug: open example.com and look for what was the referrer making request to https://maps.googleapis.com/maps/api/js?..., and it was http://example.com, and that is it. I've added http://example.com/* to the enabled URLs in the Developers Console under my respective API key and now everything works fine.
It is important to know where to look for on Firebug: it is the Net tab. Just click on the request to maps.googleapis ... and look for the Referer
I got it to work by exchanging the keys with my own special created keys AND reading this webpage a few times very carefully. My advice is to add or exchange your Google API Keys at https://console.developers.google.com/apis/credentials before embarking in very complicated scripting.
Insert your own API keys in the very first line of the Google Map javascript:
If you have been setup all configuration like api key etc, and you still got the error,
please enable all your mandatory APIs regarding to google maps.
Like:-
Google Maps Embed API
Google Maps Geocoding API
Google Maps Geolocation API
Google Maps JavaScript API

Google Analytics: Do I need URL address?

I am a complete Google Analytics beginner and would appreciate a help with a basic question.
I am developing HTML, CSS and JavaScript based applications which are further uploaded into an iOS application to present your applications in a fancy way. Therefore my application is a hybrid application (half JS web site, half mobile app).
I would love to see users' activity in my app when they are browsing through it and I thought GA might work well with it - but the problem is, that the outer app doesn't provide me with any URL of my inner JS app (the inner web site's URL is file:///).
At this page (link), I found that URL is not really important, that it is the tracking code which is important. So I used a dummy URL, added the GA snippet into my application and uploaded it in iPresent. I can't see no live activity though... :/ It also says the measuring is not installed (not used at a home page).
So I am wondering - is the URL really important?
Any ideas?
Thanks!
URL (or page path) is only important if you want to report on data based on which URLs your visitors went to.
If you app doesn't use URLs at all, perhaps it fits better with the "app" model where you are sending screen name data instead of page data. You can read more about the differences between web and app views here:
https://support.google.com/analytics/answer/2649553
I found out that URL is not needed. This type of problem can be solved by using GA Measurement Tool
https://developers.google.com/analytics/devguides/collection/protocol/v1/
Validate your hit here:
https://ga-dev-tools.appspot.com/hit-builder/

How get url of current page with javascript in google sites?

How can I get the url of the current page with javascript in Google Sites?
I need to get the full url of current page with all parameters.
window.location.href return http://nosuchhost.invalid:80.
It happens in Google Sites only, in Google blogs window.location.href works fine.
You can't run javascript in a google site.
It won't work as I don't think Google Sites will ever offer JavaScript.
What you have to remember is that your Google Site is always at a
google.com address and, therefore, many people, firewalls and virus
checkers automatically trust everything at a google.com address:
Javacript can deliver malicious code, so it's never going to happen.
You should be able to add the javascript through a gadget.
and...
As Steegle has noted, we won't be adding JavaScript anytime soon to
the capabilities of Sites.

Categories

Resources