import google analytics report in html page - html

I am having a requirement of showing google analytics report in the HTML page.I mean without login into Google Analytics , I have to show the report directly into the webpage.Is it possible ,kindly let me know how to do it.

Option 1:
Do some serverside scripting with your favourite programming language to draw data from the Google Analytics reporting API (https://developers.google.com/analytics/devguides/reporting/)
Option2:
Use Google Apps Script to pull data from you GA account. Create a graph from the data. Embed graph in Google Sites webpage. Embed Google Sites page in your site via iframe
Option3
Use Google Apps Script to pull data from you GA account. Create Json/XML-Feed via Apps Script. Pull Feed from Apps Script and parse it into your site via Javascript.
So it's doable (but not via Javascript alone without your visitors logging in to the GA Account in the Browser) but requires more programming than conveniently can be explained in a stackoverflow answer - maybe you could explore one of the options and then come back for specifics.

Related

Get Google Drive video view count from Apps Script API?

I have a series of videos uploaded to a specific Google Drive folder, and I'd like to get the view count for each video/file. Literally as simple as "file_id" "10 views".
From extensive research, it seems this is quite simply impossible within Google Apps Script today? Per this old answer, both the Drive API and the Drive Activity API only report edit or comment activity, while view activity is ignored. The Reports API does support this, but only for users with Admin access in an Enterprise account (not for us plebes who just want to know view counts on our own files).
And per this Apps Script documentation, it seems that onOpen() triggers don't run for views (which blocks a "view_count + 1 on open of this specific file" sort of analytics).
Before I give up, I figured I'd run it past this brilliant community: am I missing anything? Is there some way to get view count on videos stored and accessed through Google Drive?
Answer:
You are correct in your findings that you can not get video view count information through the Drive API. You must use the Admin SDK to obtain this information.
Feature Request:
You can however let Google know that this is a feature that is important for access to their APIs, and that you would like to request they implement it.
Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services, I'd urge you to make a feature request there. The best component to file this under would be the Google Drive component, with the Feature Request template.

How to embed a web app created using Apps script in data studio?

I created a simple calculator using Google Apps Script and deployed as web app. The calculator has four inputs and the calculated value is generated with a formula.
But I need that in data studio. So I used the "URL embed" feature in data studio. But it displays a message saying "can't embed due to provider site restrictions".
Both apps script and data studio are services provided by google. But I don't understand why I can't embed a website created using apps script into data studio.
I have deployed the web app in every possible way but did not work.
Is there any way to embed a website into data studio?
If not possible using apps script, then which other programming language should I use to create a calculator and embed it into google data studio?
Any help will be appreciated. Thanks in advance.
As you can check in DataStudio documentation, not all sites can be embeded and this resource can be blocked by the website owner:
This is related with X-Frame-Options in the HTTP header. (Documentation)
This answer has more additional information of this option:
how to block website from loading in iframe?
So I guess Google Apps Script is sending and X-Frame-Options=DENY or something that avoid it from being load in an <iframe>.
I searched a little, and I found this answer. I'm not a Google Apps Script expert, but apparently, Google Apps Script already has this feature, but you need to enable it.
Embedding Google Apps Script in an iFrame

Integrate Gmail api with Google app maker

I'm creating a google app using app maker. I want to integrate the Gmail API with the application. I went through it's guideline, but couldn't able to find any useful resource for my use case.
According to the guideline, google app script are supporting this, but I don't' know if it is possible to integrate the that it to the Google App Maker application.
Thanks in advance.
Update
I have done a bit of research and found that there's an inbuilt object called GmailApp which could be access via a server script. There are number of functions related to that. What I particularly looking for is to get/read email thread for the given subject and open it in a separate browser window, so the user will be able to interact with it (read the thread, reply..etc.)
I was able to integrate the Gmail API by going to
APP SETTINGS -> Advanced services and click on ADD SERVICE.
From there we could select Gmail API from the available services. As shown in the screen capture below.

Google app script - search hosted attachments

How to search for hosted attachments in google sites using Google App script?
I tried to search using page.search("query", options) with page type as Webpage, Filecabinetpage, but I'm not able to search my page attachments.
Can anybody help me in this?
There is no direct search method. However, you can use the Page.getAttachments() to get a list of attachments and do a manual search through them.
You can open a request in the Issue tracker for this feature to be added.

Is there a G Suite/Google Apps API?

I had several questions regarding the usability of a "G Suite/Google Apps API." I would like to integrate some sort of document/spreadsheet/presentation management directly into an application I am building.
This service would have to have the ability to import and export to DOC/XLS/PPT/PDF etc..., so something like Feng Office (if you have ever heard of it), wouldn't suit this need.
For this purpose, I'm looking into such a thing exists. Before I would begin this endeavor, I was wondering:
Do the G Suite/Google Apps productivity tools allow documents/spreadsheets/presentations to be created, read, updated, and deleted all from a third-party application?
Would potential users have to have a Google account in order to use document/spreadsheet/presentation editor?
Could multiple users on my application access files under one Google account, if an account is needed at all?
Last, is it possible to skip a Google account, and let Google docs directly access and save documents on my local server?
Sorry for the crash list of questions, but if there is anyone who could help with these, it would be much appreciated.
spryno724
Yes.
Not necessarily, you can have your backend script sign in as you, or even better, an admin account set-up specifically for your app.
Yes, see #2.
I don't think so.
(Feb 2017) The executive summary is that you can do what you envision, either by using G Suite (formerly Google Apps) APIs or Google Apps Script. TL;DR below in response to your "mini-questions".
Yes; you can do it with...
Individual app REST APIs, i.e., Sheets API, Slides API, etc., or just the Google Drive API.
Keep in mind that the Drive API is used for file-oriented functionality (create, delete, import/export, etc.) while the individual APIs are for document-oriented functionality (editing, formatting, etc.)
To learn about using the REST APIs, see the first few videos in this playlist, specifically videos 2, 3, and 4 to start with
An alternative that's more like using "services" vs. APIs but that can also programmatically CRUD G Suite documents is Google Apps Script, server-side JavaScript apps that are hosted at and run in Google's cloud. If interested, I created an Apps Script intro video for you.
FYI, videos 5, 8, 22, and 24 from the playlist above are for Apps Script if you want to pursue that
Note that neither Google Docs nor Google Forms currently have REST APIs, but you can programmatically access them from Apps Script.
Yes, users need to have a Google account but they don't have to create a Gmail address. See this page on creating Google accounts without Gmail. (If they do want to create a Gmail address, then they can use this page instead.)
Yes, you would use the Drive API to set the sharing permissions with your users. See this page on Permissions and this one on Sharing for more info.
Not really; you need at least one Google account in order to access Google Drive where the files would be stored. You can, however, manage the files on your own, then import to Drive and export from Drive to allow your users to edit on your servers then push them back to Drive. For more info on import/export formats/MIMEtypes, see my answer to another SO question.