Embed Google Analytics on thrid-part website - javascript

Trying to embed GA report on a third-part website, and I follow the Demo on Google Developers website, although I have some (silly) questions and I'm having trouble figuring it out.
After got clientid and put it my page I got exactly the same page as in google's example.
When I sent the link to someone else, it grabbed the info from the properties from people's GA I sent the link to, not my website.
Can someone help me set the property and eliminate the dropdowns to choose Account, Property, Views?
Thanks,

What you're asking is to do user authorization server-side. This will allow you to show Google Analytics data on your website without requiring your visitors to log in.
You can view the Embed API Service-Side Auth demo to see a working example.

Related

How to track Facebook sale traffic in GA (gtag.js)?

Google analytics actually shows that payment gateway is the source of traffic that brings in the sale, which of course is triggered by the fact that they leave my website to pay and then it comes back to my website to place an order.
I was wondering if there is any ways to track the customers from where they come from (such as Facebook page) and if you have any suggested workaround. I want to track where the sales is coming from and this is making it a little hard for me.
For now, I have implemented the tracking code GA (gtag.js) in my website, but all I see is just it track the source within the website as if user click product category A to category B based on this tutorial https://developers.google.com/analytics/devguides/collection/gtagjs/.
I do some research about cross domain tracking here https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain, but where do I find the linker parameter? Does this tutorial will help to solve my problem?
One more, do I need to do anything with Google Tag Manager and Adwords?
Really need help, thank you :)
Check that your payment gateway is included in the referral exclusion list. In that case it should be ignored and the original traffic source should be retained (unless the redirect parameter adds campaign parameters of his own).
Cross domain tracking is not appropriate here. Cross domain tracking means to have a continuous session over multiple domains, which requires that your tracking code is placed on all the domains.

Youtube API User History (Playlistitems) without Authorization

I'm trying to retrieve the watch history data of my own Youtube account using the Youtube Javascript API. I am using the auth.js listed here.
I have made everything work, but it requires authorization (website asks you to login with a Google account so other people cannot view what i'm displaying without logging into my Youtube account).
I'm looking for a way for a website to display my Youtube history data without authorization. Reading similar questions here and googling seems to suggest that it's not possible with just Google Client API. If anyone knows a way to do this or where I should look for, please let me know. I'm new to web stuff so any help will be appreciated!
Thanks
Very simple answer: It can not do without Authorization
You can do that in different way
after Authorization you can sync your youtube history with another database and show that data from fetching from that database to others

Google analytics credentials at client side

I am currently new for Google analytics API throu Javascript. I am implementing some of charts and for first load, page is redirecting me to google site to login with Analytics account and then returning to my orignal page, refresh & chart show.
Here, I would like to avoid users to redirect to google analytics page and instead of that I want to stored credentials somewhere in config file or in application variable.
I tried to search and read many blogs & articles however no success.
Is there any trick/ ideas by which I can get any API which could resolve this issue?
Google doesn't allow you to pull the physical charts onto your site, since they are generated on the fly. What you can do, is grab the data from their API and then display the data as needed on your site. I have searched and found a few examples with this one looking like it might do the trick.
It goes through the steps of pulling the data through the API, displaying/formatting/styling the data, and adding the chart to the page. Try that, Embed Analytics Using the Google Analytics API.
the reason why you are redirected to a Google login page, is that Google connects to the analytics data for whichever user you log in as. This means each user that logs into the site would see their own Analytics info, not the info from a static account.
If you want it to be the same user's analytics data no matter who is logging in, you would need to setup a "Service Account" on Google's API Console (https://code.google.com/apis/console/), then use those credentials when logging in.
It seems like a lot of people are looking for a solution to this, so I created a nuGet package that:
- connects to a "Service Account" you set up in the API Console
- Pulls any Google Analytics data you would like
- Displays that data using Google's Charts API
and it does all of this in a very easy to modify way. You can see more here: https://www.nuget.org/packages/GoogleAnalytics.GoogleCharts.NET/.

Show GA stats of the website on the website itself

We need to show the number of visits for pages of our website. We already use GA for general reports and we assumed that it might make sense to use GA API to get number of visits data from GA instead of building our own counters and increase load to our database and web server.
I read documentation and already know how to build queries that I need. The main problem I'm trying to work around right now is an authorization process. Sounds like if we use OAuth 2.0 each user has to authenticate before he/she can see the statistics on the page and they will have access to statistics of their websites (if they have them registered with GA). In our case this is incorrect, everything we need is just to show our own GA stats at our own website. Easy task as we thought initially but it doesn't sound like that anymore.
Is there a way to authorize our website to Google (like we send come credentials when we use Maps API) and show stats automatically to any user? We wanted to implement it on client side via JS but if this is possible to implement it on server-side only - that's OK. The target platform for server-side implementation is ASP.NET (just in case). Can someone point us in the right direction?
Quite a few options:
You can use OOCharts and a script like this
Use a service like embedded analytics (paid)
Use SeeTheStats and it's widgets
Use google charts and JavaScript
Use explanium to embed a ga chart
Piwik can embed charts too.

Cross domain authentication... How?

I'm working on a web application where users will create accounts. Then clients will be about to have a section on their site for users to login with my sites login credentials. However... I don't want the clients site to be able to see or handle their login credentials. I am wanting to do cross domain authentication just like facebook connect does.
I have done research and it looks like I will need to create a javascript library that users will need to add into their site. Inside that javascript file I will need to create an iframe that will connect to my main site. From there a cookie will need to be placed then checked.
Does anyone know of well written tutorials on how to do this or could you explain in detail on what all will need to be done?
EDIT:
How would the storing and reading of cookies work. Anyone have examples?
The simplest way would be a plain iframe. Twitter does it a lot. If your have to communicate with the parent site for some reason, try building an API with the postMessage function.

Categories