Update value in of custom metric in google analytics using python - python

I have created a custom metric in google analytics, and I would like to update the value using python. I have found plenty on updating the metric metadata, but not on updating the actual value. Is this possible ?
Our situation - We have custom data stored in local mysql that we want represented in our google analytics dashboard, but we are not willing to open up inbound acl's to allow the dashboard access to our db's. So we though we can post the data to custom metrics in GA. If this isn't possible, or someone has opinions on other ways to handle this, we are all ears.
Thank you.

Once data has been inserted into Google Analytics it can not be changed. So if you mean that you want to change a value for a custom metric which has already been inserted for a day in into Google Analytics the answer is that you cant.
If you want to programmatically change the value of custom metric (in the admin section) which will effect all new data being inserted then you can use the Management API please note that the management api write operations are in beta you will need to apply for beta access before you can do this.
Write operations in the Management API (e.g. create, update, delete,
patch) for Web Property, View (Profile), and Goal resources are
currently available as a developer preview in limited beta. If you're
interested in using these features, request access to the beta
In my experience it can take at least a month to get access google will send you an email if you have been accepted.

Related

Smartsheet API to Collect Payment Information

Has anyone used Smartsheet API to capture payment data?
I work with a Property Management group that will be accepting applications via Smartsheet's web form. Those applications require a deposit. My city uses NIC Inc. (EGOV) as their payment gateway. Apparently there are a couple of reports (one daily, one # each transaction) that will give us all the information about the payments but it would be best if Smartsheet could collect the information automatically.
I am very new to coding but I have good resources to call on to implement suggestions.
It's certainly possible to write data to your sheet using the Smartsheet API (we even have a Python SDK to help with that).
Your next step should be to determine whether the eGov API supports the exporting of the data that you want to bring into Smartsheet.
Assuming both APIs do what you need, then the person writing the scripts can automate them by using a cron job or a webhook (if eGov API supports it).

create a web application using google analytics api and its client google-api-python-client?

I was going through googles's api python-client-library and google analytics api . I was able to do all steps mentioned in official docs but then I got some doubts. Since I've never done this kind of thing before, so I need your valuable suggestions/tips.
My Goal:
Want to design a web application in Python(using django/flask) and google-api-python-client. I have few matrices(coming from my web ecommerce product that is using GA.) and I'm not sure if google analytics dashboard by default support at that deep level. so I will use Google's analytic api to customize data according to my need and show in my analytic web app(which can be accessed by any one).
Doubts/Queries:
1) first of all which reporting api I would be needing for this mentioned here. core api or metadata api?
2) while I was setting up the project and client key, I chose 2nd option(OAuth 2.0 client ID)
is that ok or should I chose service account? once I selected 2nd options there were couple of radio buttons(web, android, ios, other, etc.) I chose other or should I chose web?
3) once i chose other option from radio button list, I executed my script and it prompt a browser to ask for permission, I allowed. here my question is if I put my application on production would there not be any browser, what would happen in that case?
I would really appreciate if you can help me in these queries, sorry for long question, this is my first question.
PS: Bottom line is how one should structure and develop there analytic web application in general.
The key thing to understand is that Google Analytics is an authenticated API. It is designed make it easy to allow the end user to access their own data. It is designed to be hard to allow the end user to access data they do not own.
If you are building a web application to allow your users to access their own private data It is recommended that you use a client side authentication method, such as in this example or this example.
If you are trying to build a web application that shares your private data with your users there are a few ways to go about it:
You could collect the data server side in python using a service account (note you will have to add the service account the GA account you wish it to have access).
You can take a hybrid approach and have a service account generate an access token and use the embed api to actually make the query.
In the end I would encourage you to spend some time to read Using OAuth 2.0 to Access Google APIs, and understand senarios descussed and ask yourself which of these senerios will work best for my application.

How to extract information (citation, h-index, currently working institution etc) about all professors in a specific field from Google scholar?

I want to compare different information (citation, h-index, etc) of professors in a specific field in different institutions all over the world by data mining and analysis techniques. But I have no idea how to extract these data of hundreds of (or even thousands of) professors since Google does not provide an official API for it. So I am wondering are there any other ways to do that?
Use this google code tool will calculate an individual h-index but if you do this on demand for a limited number in a particular field you will not break the terms of use - it doesn't specifically refer to limits on access but does refer to disruption of service (eg bulk requests may potentially do this) the export questions state:
I wrote a program to download lots of search results, but you blocked my computer from accessing Google Scholar. Can you raise the limit?
Err, no, please respect our robots.txt when you access Google Scholar using automated software. As the wearers of crawler's shoes and webmaster's hat, we cannot recommend adherence to web standards highly enough.
Web of Science does have an API available and a collaboration agreement with google scholar but Web of Science only for certain individuals
A solution could be to request user's web of science credential (or your own) to return the information on demand - perhaps for the top ones in the field, then store it as you planned. Google scholar only updates a few times per week and this would not be excessive use.
The other option is to request permission from google, which is an mentioned in the terms of use, although seems unlikely to be granted.
I've done a project exactly on this.
You provide an input text file to the script with the names of the professor you'd like to retrieve the information from, and the script is able to crawl google scholar and manage the info you are interested on.
The project provides also a functionality for downloading automatically the profile picture of the researchers/professors.
In order to respect the constraint imposed by the portal you can set a delay between each requests. if you have >1k of profile to crawl it might take a while but it works.
A concurrency-enabled script has also been implemented and it runs way faster than the basic sequence approach.
note: in order to specify the information you need you have to know either the id of the class of the html generated by google scholar or the name of the class.
good luck!

PayPal Classic APIs determine account type

How do I determine which type of account a person has when using the permissions api? I need to make a different decision if they have a pro account versus a standard business account. Thanks!
This can be be done using the Adaptive Accounts API and more specifically the GetVerifiedStatus call.
A successful response will include the UserInfoType Fields including the accountType which is what you're looking for.
You can find what a successful response looks like here, click on GetVerifiedStatus and fill in the blanks.
I'm not aware of any way to see that via the API. That's typically something you'd leave up to the end-user to know when they're signing up. Ask them if they have Pro or not, and based on that, setup your permissions request accordingly.

Datastore vs spreadsheet for provisioning Google apps

In my company we want to build an application in Google app engine which will manage user provisioning to Google apps. But we do not really know what data source to use?
We made two propositions :
spreadsheet which will contains users' data and we will use spreadsheet API to get this data and use it for user provisioning
Datastore which will contains also users' data and this time we will use Datastore API.
Please note that my company has 3493 users and we do not know too many advantages and disadvantages of each solution.
Any suggestions please?
If you use the Datastore API, you will also need to build out a way to manage users data in the system.
If you use Spreadsheets, that will serve as your way to manage users data, so in that way managing the data would be taken care of for you.
The benefits to use the Datastore API would be if you'd like to have a seamless integration of managing the user data into your application. Spreadsheet integration would remain separate from your main application.

Categories

Resources