I have a URLShortener application and I want to use Google Analytics for shorted urls. But I use Response.Redirect() method and I can't use local script of google analytics.
I want to know is it possible to have something like google analytics script in server and run it?
There is the Microsoft Silverlight Analytics Framework which also supports Google Analytics.
I would assume that they do this in C# code, which should be adaptable to be used inside server-side code, too.
Yes, it is possible to use google analytics in server. You need to have a Google Analytics account, as explained here.
After setting up your account they will give you a unique tracking code along with a javascript code which you have to put in your website or master page which you want to track. This javascript code will do all magic for you and you can watch this information from your GA account.
You can even integrate this chart with your website, using the Google chart facility through
Google Analytics Easy Dashboard Javascript Library (more information here).
From this tutorial you can setup your website to catch GA data into your site and display in your own webpage through Google charts.
Sure, it's technically possible. All GA does is set some variables and makes an HTTP request to the GA server, which can be done with JS or by grabbing a gif from the server.
The main issue is that you won't get a lot of the data that you would expect like browser, location, OS version, etc. because the client making the request would be your own server.
It would probably be best to add some event tracking data to the redirected location and track that with GA event tracking, that way you could get a more accurate dataset.
If you do want to continue down the path of most resistance though, this is a pretty good write up of how you'd go about it. http://automateeverything.tumblr.com/post/20500736298/google-analytics-without-javascript-or-cookies It's not C# specific, but you should be able to abstract it.
Related
I am creating a console application in c#(visual studio).
but i don't know where to start.
1st i want to login(phantomjs or selenium)>>then go to a (specified)website URL and extract html?
i want to know how to save login information in my web request.
thank you.
Long story short, it's not easy to do that just with web request because each site has its own way of managing cookies and security.
It's easier if you use a web browser control to login first. From there, the browser can obtain a valid cookie and you can start crawl data from there.
I've done a similar thing with Chegg website. For details, you can check out my repository https://github.com/hungqcao/chegg-solutions-saver
In your case, it can get a little complicated since FB, Twitter may have 2-factor authentication or something similar to that but the idea stays the same.
Let me know if you need help.
I am playing around with Google Music. I'm trying to see if I can write an app that will stream my music files uploaded to Google Music. So far, I've managed to authenticate myself using ClientLogin and access the music.google.com page. However, whenever I try to access http://music.google.com/music/services/loadalltracks, the page that contains all of my tracks in JSON format, I get a 401: Unauthorized error. However, if I pass the cookies containing SID and HSID, it works and I can access the page.
Does anyone know why It doesn't work with ClientLogin, outside of Google not supporting it with Music? Have you had similiar experience with other Google Services? In the event I can't get ClientLogin to work, is there anyway to work around it, using the SID? I don't know how the HSID is generated.
Since there is no official api for Google Music, you need full SSO credentials to use those endpoints. The easiest way to do this is to emulate a browser (with eg mechanize).
The way my unofficial Google Music api accomplishes this is a bit cleaner, but more work: use clientlogin to authenticate to the Music Manager service, then upgrade those credentials using tokenauth. This isn't really a public feature, but it's described by a third party here, and by a Google design doc here. The specific endpoints you need are in my code here (in clientlogin.py and tokenauth.py).
You'll want to send u=0 and xt=[value of xt cookie] in the querystring as well. The first argument specifies which account you're using (if you're signed into multiple), and the second is a xsrf token.
Well, as far as I can tell the reason sending the SID and HSID cookies makes the request work is because you're simulating the way a normal user is accessing the service.
You can't go the regular application way because that's not supported in google music (as far as my internet research showed, there's no API for google music).
Oh, and one thing: google discourages people from using ClientLogin and instead tells people to use OAuth ("ClientLogin [is] Google's proprietary authorization API ... you should avoid using [this] service." found at http://code.google.com/apis/gdata/docs/auth/overview.html) so in the future you might want to use that. Maybe it'll even work in this case (It sends a different token from ClientLogin - OAuth token instead of an Auth token) though I doubt that.
Anyway, I hope this cleared things up.
I'd like to get a list of the backlinks reported in Google webmaster tools programaticallly but the GData API doesn't include this.
http://code.google.com/intl/sv-SE/apis/webmastertools/docs/2.0/reference.html
Is there any good way to get these links?
What's the best way to get a list of backlinks to a site?
the api does not support it.
i use a fake-script (http://fakeapp.com/ a programmable browser) (any programmable browser will do) which gets executed daily the get this specific data. in my opinion it is the best backlinks data you can get.
There is a php script that you can use to download the backlinks as a csv file which you can then use.
https://github.com/Adduc/php-webmaster-tools-downloads
A pull request was just made to the main repo.
new to facebook dev and I have read the basics to get a site up and running using the canvas setup. Nice and simple, I have also got the integration with users working ok (i.e. the signed_request).
I was wondering how it works with "sending/posting" data from one site that is anonymous (my own external to facebook) to the facebook site.
The flow I'm after is a user is looking at some content my site A (my own external site) and then clicks the "share on facebook" button (or whatever), which sends the user (and the data they were looking at) to the site B (my facebook app) to which they authenticate and then (and this is the part I dont get) can see that content on their personalised homepage within site B.
So is there a way to POST some kind of data to the facebook site? Or do I need to do something else here?
Thanks a lot.
You use the facebook API located here:
http://github.com/facebook/csharp-sdk
The .zip download includes the api that you can compile, as well as a sample project that uses it.
Reference: http://developers.facebook.com/blog/post/395/
EDIT
Here is some more info regarding the facebook graph api. I think you'll find everything you need in here: http://developers.facebook.com/docs/reference/api/
Does anyone have a simple and successful demo implementation of facebook connect in an asp.net application. I am developing an asp.net web application and want facebook connect to be the primary method for logging in.
I was having troubles as well, but found that this stackoverflow question got me on the right track as far as the server side stuff is concerned
However, First you have to get the facebook connect button working from here Facebook Wiki
Then detect if they are logged in or not and redirect them appropriately to a welcome page.
Detect login via Javascript
Most other actions can be done via serverside with the Facebook ToolKit. (eg get their information, friends, etc..)
The last thing I think I should mention is logging the user out, so take a look at this. Facebook Wiki: Logout
Hope this helps
As I see, all the above examples and links are really outdated. The new Facebook Graph API makes the whole process a lot easier, without the need for any other components:
http://area72.ro/general-it/how-to-login-via-facebook-in-asp-net.html
try to use the toolkit called Facebook Developer Toolkit
you have in Steve Blog a post about it, and you even download he's Starter Kit so you can view all the code :)
Hope it helps
I know you asked for ASP.NET resources. The Facebook Connect page provides some good information as well as the source to a sample implementation using PHP. Hopefully you can pull some good information from the PHP code.
http://developers.facebook.com/connect.php Check out the links on the right side.
The provided demo can be accessed here... http://www.somethingtoputhere.com/therunaround/