GAE Mailhandler to Google Analytics - google-app-engine

I'm running an app on GAE that does a number of things. One of those things is receiving an email with attachment and responding with a mail with a CSV attached to it. The category of people that use this option, never visit the site.
Would it be possible to add something to my mailhandler so that every mail received is processed as a page visit in Google Analytics?
I'm using Jinja2 as framework.

You can use Google Analytics for Mobile Websites. It allows for server-side invocation.
Basically it just produces an image url that triggers GA when loaded in mobile site. In your case you should invoke this url with your own parameters. Here is an example Url:
http://www.google-analytics.com/__utm.gif?utmwv=4&utmn=769876874&utmhn=example.com&utmcs=ISO-8859-1&utmsr=1280x1024&utmsc=32-bit&utmul=en-us&utmje=1&utmfl=9.0%20%20r115&utmcn=1&utmdt=GATC012%20setting%20variables&utmhid=2059107202&utmr=0&utmp=/auto/GATC012.html?utm_source=www.gatc012.org&utm_campaign=campaign+gatc012&utm_term=keywords+gatc012&utm_content=content+gatc012&utm_medium=medium+gatc012&utmac=UA-30138-1&utmcc=__utma%3D97315849.1774621898.1207701397.1207701397.1207701397.1%3B...
See here for a full list of parameters.

Related

Estimating cost of Google App Engine API script using “x-appengine-estimated-cpm-us-dollars” header

I created an API using Python + FastAPI and deployed it to Google App Engine and I would like to measure the cost for each request made.
I saw there is a header "x-appengine-estimated-cpm-us-dollars" that show up when logged in with the owner account on GAE, but I didn't see it when accessed the API using the browser "https://example.uc.r.appspot.com/api"
Any idea how to can I see this header or a way to get an estimated cost for each request made?
Note: the deployed script is an API, not a website with auth like the one mentioned here (Usage of X-AppEngine-Estimated-CPM-US-Dollars in AppEngine)
According to the documentation:
If you access dynamic pages on your site while signed in using an administrator account, App Engine includes per-request statistics in the response headers
And then shows the description for this particular header, therefore, this is not something that is available for APIs hosted in AppEngine.
You could alternatively use the Cloud Billing API to gather some information, although not exactly the same.

How to tell google analytics that I am a bot?

I recently wrote a tool that checks if certain requests on a web page are fired. For example is jquery from a google server loaded when I visit StackOverflow? The tool is based on webdriver and a chrome browser.
The tool works like a charm but it also generates google analytics traffic that should not be there.
Is there a possibility to tell Google that the tool is a bot and should not be counted? All solutions I found focus on the page under test and how to not collect data via Google. I need a solution that works without changing the website's code.
Possibly the easiest way would be to send a custom user agent string along and filter by that via a view filter.
Untested, but I think if you use the same user agent string as the Google crawler I'm pretty certain it will be filtered out automatically (after all Google should be smart enough to filter their own crawler). According to this page the Google crawler UA always contains the string "Googlebot" (else youD have to go through your server logs to find a likely UA string).
We solved our problem with a chrome extension. That extension redirects all requests against the google collect endpoint to example.com. Works like a charm.
Here is the Answer to your Question:
It sounds interesting to know about a tool which checks if certain requests on a web page are fired for e.g. jquery from a google server loaded.
Practically, there is a lot of difference when a page e.g. StackOverflow.com is opened Manually (through keying in the URL manually) and when chromedriver exe is used to initiate the new Google Chrome session.
As an example, manually when we open a new Google Chrome session, the command line parameters which gets passed along with chrome.exe are --flag-switches-begin and --flag-switches-end only.
But when we try to use chromedriver exe, we generally take help of ChromeOptions class and DesiredCapabilities class to add various config parameters to the Google Chrome session. Apart from all these one parameter is added i.e. --test-type=webdriver.
Hence any website when accessed by chromedriver exe is always aware that it's a Automated Bot.
Let me know if this Answers your Question.

Rejected request to participate in Google AdSense (Phase 1)

I am trying to register my web app for the service of Google AdSense.
After five attempts are still stuck in the first phase for the error: Content insufficient.
My web app is a search engine for youtube, developed with AngularJs and NodeJs
AngularJS fully embraces the asynchronous model and this is what creates problems for Google's crawlers. So I implemented the library prerender.io and I have set up the meta tag to fix any problems with the # of Angular.
 
<meta name = "fragment" content = "">
I also prepared the sitemap.xml within the site, and that index the pages through the portal of google for webmasters.
The site being a search engine, does not have static content and reach, so I also added some texts and descriptions in the page principle, which houses the other partial files.
Despite these changes, I could not pass the first stage, how can I do to fix?
I'm not making all the necessary steps for a web app Angular?
To be approved in Google Adsense you need about 10 topics of 400 words. The content should be unique. According to Google Adsense TOS it is not allowed to put ads in pages having copied content. So in your case if you provide search results you will provide copied content.

How does one google app engine app serve multiple domains?

Or can it be done?
For example, I want to help a few friends to setup their shopping cart websites. They have their website domain names already purchased. But I want to pay one google app engine application at www.mywebsite.com, and I want to "forward" their domain to www.mywebsite.com/friend1, www.mywebsite.com/friend2. In this way, I want their customers see their website which could be http://www.friend1.com, but they are actually served by one single app engine application.
In my application, I know how to get the path analyzed so I can go to datastore to serve diffrent pages, html. So the question is just how or can one google app engine be forwarded from different domains. Thanks!
I'm not quite sure what is your exact meaning of "forward", but I try to answer for different situations.
If you want the browser to keep displaying www.friend1.com all the way without ever showing www.mywebsite.com, you should have friend1.com setup as a Google App account, and add their domain into your application (just like you did for your own domain). This way, all traffic to www.friend1.com (or what ever subdomain they pick) goes to your appengine app. And your App should detect the domain of the http request and response accordingly.
If you just want a "redirect"... that means, user goes to www.friend1.com will have their browser auto goes to www.mywebsite.com/friend1 and displaying it in the URL bar , well, just setup one index.html page in www.friend1.com and add meta refresh header in the file. Or use any server side redirect method.

GAE Java Facebook server authentication double call

I am having a weird issue. I created an application on Google App Engine and have a Login with Facebook button on it, for which I am doing server side authentication.
I give the redirect_url, and facebook was calling the URL correctly with no issues. The session parameters that I set were being retrieved on the redirect call and everything was working fine.
Yesterday, I got a domain on godaddy and mapped it to my appspot account using google apps. Now when I click on Facebook login, I am getting two calls on the redirect uri, the first one carries the session varaibles and the session one doesn't. I am not very familiar with domain mapping and followed the steps on Google Apps.
Can anyone help me in the right direction on this.
it's a little out of date, but i documented some GAE to Facebook gotchas here:
http://javagwt.blogspot.com/2010/08/facebook-apps-on-app-engine-without-any.html
It may also help to read about naked domain mapping with godaddy, to make sure you're not getting bounced around. Even though you are mapped to your domain through google apps, you can try to put the redirect URL for facebook as yourappid.appspot.com - the redirect URL you provide, and the one in your facebook app settings must match.
My app, nimbits.com writes to facebook from GAE all of the time - the code is on github under server/facebook
https://github.com/bsautner/com.nimbits/tree/master/nimbits-tds/src/com/nimbits/server
Thanks for the answers bsautner and Michele. I finally figured out the issue. I have google ads on my website. The google ads was trying to parse the URL content and creating a second request for every request that I create. After removing the google ads, I get a single callback with session values retained. It all works now. The final output is this website - www.imagecrashers.com. I will be glad for any suggestions from the gurus here, regarding layout or api calls simplification. Thanks again to all.

Resources