I have a conceptually simple problem involving Google Analytics and Tomcat, but I cannot solve it.
We have Google Analytics set up for our production machine and it is working fine. I want to set up a Google Analytics account to monitor our test system so I can test various features without affecting/polluting our production data. I have a test system set up, and a test Google Analytics account. However, the test Google Analytics account never receives data from the test system.
From my investigation, it appears that the problem is that my test system is being referred to as "localhost" instead of "test.mycompany.com" and the document.domain property used by Javascript is therefore "localhost" instead of the "test.mycompany.com" URL that it should be. This is causing the Google Analytics cookies to be written incorrectly (I think) and therefore the Google Analytics Javascript code is never sending data to my Google Analytics account.
Is there any way to set this "document.domain" property in Tomcat 6 so that this system will think it is "test.mycompany.com" instead of "localhost"?
I have examined both the Tomcat docs and the Google Analytics docs, but neither of them address this point directly.
Any help would be appreciated.
Open your firewall on the test server so google can access it and use add this in the snipet
_gaq.push(['_setDomainName', 'none']); //has to be place before _trackPageview
also open your firewall for ga
https://ssl.google-analytics.com/__utm.gif
http://www.google-analytics.com/__utm.gif
and
http://www.google-analytics.com/ga.js
So, port 80 for HTTP, port 443 for HTTPS and the site(s):
ssl.google-analytics.com
www.google-analytics.com
See stackoverflow.com/questions/9738815/google-analytics-gif-request-not-sent/9741228
Google Analytics doesn't send the tracking GIF for localhost, unless
_gaq.push(['_setDomainName', 'none']);
is added before the _trackPageview
Related
This is a pretty general question with a couple examples. I'm fairly new to writing chrome extensions and I seem to keep running into cases that are impossible to test without deploying to the webstore (which takes ~60m each time). This is an impossible workflow. Am I missing something?
Case 1 inline installation
Trying to set up inline installation from my site to a chrome extension. When I run the site locally i get the following.
Error downloading extension: Inline installs can only be initiated for Chrome Web Store items that have one or more verified sites.
But I cannot seem to add localhost website property in chrome's developer dashboard. What is the recommended way to do this in a dev environment. I tried using local.mywebsite.com and adding a local alias for localhost, but now chrome cannot find the verification file you are required to serve...
Case 2 Chrome Extension OAuth
Attempting to use chrome.identity.launchWebAuthFlow to setup user credentials in my extension for my website, but of course the callback url provided https://<ext-id>.chromium.org/provider-cb does not redirect to my local deploy of the extension.
Is there no way to test these things??
Regarding your error "Inline installs can only be initiated for Chrome Web Store items that have one or more verified sites.", you may follow the instructions given in this page.
You need to:
Go to the Webmaster Tools.
Add the site to your sites.
Obtain and embed a verification code into your site.
Complete verification in Webmaster Tools.
Go to your Developer Dashboard (must be under the same Google account) and edit your Web Store item.
Select your site in "Verify that this is an official item for a website you own:"
Here are some references which might help in testing extensions:
Testing browser extensions
How to test chrome extensions?
I am building a web app with Google AppEngine. I am using the Google Maps, Google Places, and Geocoding API's.
In the local version, everything works as it should. When the page is loaded, the user's current location is indicated and all the nearby stores are marked with markers on the map that appears on the webpage.
In the deployed version, only the map loads. I checked the console developer's log on Google and I noticed that a request to the Google Maps API is made, but not to the Google Places or Geocoding API's. I'm really confused/not sure what's going on. I tried browsing through some old questions, but I can't figure out how to fix this. If anyone could offer a solution, I would greatly appreciate it.
** I have made sure that the deployed version is the most recent version. It 100% works on localhost, but doesn't on the deployed webpage.
Edit: the API's aren't being called because they don't work on "insecure origins". I've configured the app.yaml under handlers to be
- url: /.*
script: IGNORED
secure: always
but it doesn't seem to make a difference.
You don't have to separately call Google Places and Geocoding APIs. All those are included in the Google Map API. If you want to choose on what you should include in your map click here to refer the API on customizing your map.
By default, Google App Engine doesn't support secure connections, which both the Geolocation & Google Places API's need, in order to be called. However, Google App Engine can support secure connections. The local host does support secure connections, which is why the local version of my app was working.
To properly support secure connections after deploying the app, just add in the parameter "secure: always" in the app.yaml file under Handlers!
So I'm building a Phonegap app and I need to access Youtube's Data API. I managed to access the simple API (The one that requires an API key) yet I'm having trouble connecting with OAuth.
I did everything the walkthrough guides told me to do, I have generated a Client ID for Web application from https://console.developers.google.com.
I'm using the auth.js file from their example at the google developers website
The main issue is that every time I try to log in, I get this error:
Refused to display
'https://accounts.google.com/o/oauth2/auth?client_id=' in
a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
I tried clearing my cookies but to no avail.
I run this on localhost with Visual Studio, maybe this has something to do with that?
Ok, so after spending some time on it I finally figured out what the problem was.
On https://console.developers.google.com when I created my OAuth 2.0 client ID there was the "Authorized JavaScript origins" field which I left blank. Since I was running it from my localhost, I added http://localhost:28299 to the list of safe origins and everything worked fine.
Of course this is just for the development phase.
I'm currently working on a platform that will be launched all over the world and I am working in Shanghai China and as you might know there is a very big Firewall policy here.
The site contains a custom map view created with the Google Maps API this is because Google allows a lot of nice features to change the look and feel of the map.
But now I'm running into a problem where if a user wants to access the site without VPN the whole page where the map is located slows down,crashes and breaks my login procedure.
Here are the errors showing in the Console View:
GET https://maps.googleapis.com/maps/api/js?key=1010101010101&sensor=true net::ERR_CONNECTION_TIMED_OUT
Uncaught ReferenceError: google is not defined
I want to know if there is a way to check if I have a connection to the Google Maps API before executing the code?
Cheers,
Koen
Checking if the API is loaded, as Keith links above, is a good way to see if the loading has had any trouble.
To minimize problems loading the API in China the Maps API FAQ recommends loading the API from http://maps.google.cn/maps/api/js and not using https.
I am willing to fiddle with Evernote API and use it Chrome/FF extensions. What I learnt that so far no JS API available which makes me to think to make a middle tier service in php/python and let my extension to access Evernote via that service.
The place where I am confused is authentication. How do I make a user to authenticate with Evernote from a browser extension? If it;s showing a html static page which then redirects to EverNote Login Page and store access token etc at server side. How will my extension remember logged In details and make calls to service and create/retrieve notes in my Chrome extension.
The workflow of App is following:
User will be able to login on Evernote via Extension(by accessing page of Logging).
After successful logging notes will be retrieved via middle tier service in Chrome Extension via Ajax Request.
USer can then post note via AJAX call to service which will then eventually store in Evernote via its API
Please guide me.
There are no official javascript API. But you can find a few un-official ones.
Take a look here for example : http://discussion.evernote.com/topic/22476-api-for-javascript/
Don't know how they work however.
Here's another solution :
Not sure it's the right way to do it but you could mimic the way the evernote webclipper works.
Basically it uses a internal customerKey / customerSecret along with the username and password to retrieve an oauthToken. Then it uses this OauthToken for all api calls.
You can find the process in the Auth.js file of the webclipper source code.
On a mac, the file is located in /Users/%user%/Library/Application Support/Google/Chrome/Default/Extensions/pioclpoplcdbaefihamjohnefbikjilc/5.9.5_0/js/main/Auth.js
I don't know on other systems but it shoudn't be too difficult to find on Google.
Hope that helps.
Now you can find an official JavaScript library. (I'm not sure limitations of Chrome extension though)
https://github.com/evernote/evernote-sdk-js
I find it here.
http://discussion.evernote.com/topic/34619-how-to-access-evernote-api-in-firefoxchrome-extensions/#entry250743
The FAQ of the library says that
Can I test my code in the browser
Yes. You can test your code in Chrome. Open Chrome using open /Applications/Google\ Chrome.app/ --args --disable-web-security .