how to track traffic source for a Facebook iframe application - facebook

I have a facebook iframe application - let's call it apps.facebook.com/my-app.
We currently use Google Analytics for our tracking, and I correctly have Google Analytics installed on my application (that is included via iframe to the FB app) & it is tracking any use of the application mentioned above.
However, I would like to find out what the traffic source is to my-app PRIOR to facebook; ie, if a user goes to domain1.com, and follows a link from there to apps.facebook.com/my-app, it appears that the "traffic source" gets tracked as "apps.facebook.com" rather than "domain1.com", b/c the GA is installed within my code of the page included via the iframe, so its http referer is apps.facebook.com
Is there any way to retrieve "domain1.com" as my traffic source, in this case? Or any suggestions to try? (whether using Google Analytics, or another source? I see that the facebook insights does give some information on referrers, but it's not very extensive at all; no date ranges, etc)
Thanks so much!
- ali

Just using Google Analytics in Facebook, there isn't much you can do here. However, what we've done in the past (to general success) is to create a redirect link outside of Facebook with the analytics on it, and push all traffic there first.
In other words, create a page at www.myapp.com/redirect, and put the google tracker there (or, alternately, just append the referrer url to the query string manually). Then, redirect with javascript out to the Facebook canvas app URL. That way, the user ends up in the right place, and you get your referrer info as well.

Related

Enable Google Analytics email tracking with unknown and untracked URL

Good day,
Background: We have a single web application that multiple external websites link to; users visit www.aaa.com or www.bbb.com and can then click through to our web site at www.example.com.
When we send email comms, the users are directed to their respective client URL.
We require a method of tracking these users from email comms using Google Analytics so that we can see their activity in the Campaigns section.
Issue: The problem is that whilst we have Google Analytics enabled on www.example.com, we are not able to install analytics on client URLs. This means that if we affix the Google tags after the URL in emails, these are stripped out when a user then navigates around a client URL before visiting ours. This then means they do not appear in the 'Campaigns' tab of GA. That is:
trackable --> www.example.com?utm_source=offeremail&utm_campaign=testcampaign&utm_medium=email
not trackable -- > www.aaa.com?utm_source=offeremail&utm_campaign=testcampaign&utm_medium=email
Question: Are we able to start the tracking once a user clicks a link in an email but then accesses our site from another site and then show the results in the campaign tab?
Thank you!
Short answer: No. You need to pass the UTM-parameters in the URL for Google Analytics to understand it is campaign traffic. This is usually the issue with redirects between websites, that this UTM-tagging is lost, thus losing the campaign information.
What I would suggest is that you look at referrals or have your clients add tracking to the links back to your website. Then correlate that to the dates of your send-outs. It is a bit of a middleground, but it should do the trick to atleast see trending success.

Differentiating between Google Analytics Tracking of Facebook App and Web App

I have a web app at www.mydomain.com/webapp and its set up with Google Analytics. I create a facebook app at apps.facebook.com/webapp and iframe in the above url.
Is there a way to distinguish activity of users on facebook from users on mydomain?
Thanks for any help and direction you can give me.
You could use JavaScript to determine that your page is displayed in an iframe – but that would also be true if maybe other sites embedded your page.
A better way would be to check for the [signed_request][1] parameter that gets POSTed to your app on initial load into the iframe. (If you were paranoid about someone “faking” that, you could also verify the signed_request.)
Once you figured out that your page was actually loaded inside Facebook, it should be easy to execute the appropriate JS code to send that info to Analytics.

Facebook External Widget development with a single app

We're trying to develop a widget that uses Facebook APIs and other websites (e.g different domains) could embed. We do not want every website to create it's on Facebook app but we'd like everyone using this widget to be connected to our Facebook app.
The problem is that Facebook seems to authenticate only a specific domain for an app (Canvas URL).
Ideas?
Guy
Update: I just realized that for Facebook server API as long as I set the redirect_uri to a valid URL (as defined by the site url) then everything is OK. So I can let my widget call the login and set the redirect_uri to some page we hold on our server that will communicate with the origin. So far so good. Now the problem that remains is whether there's a way to do it using the Facebook JS sdk rather then having to invent the wheel. From what I see there I could find a way to make the JS SDK not use the window.location.href. Ideas?
you just need to create the app, then from the profile site of your app there is an link to let users add the app to their page. (this is also possible via a special link (see the docs))
but be aware, one page can only include your app once. so if you like your "customers" to have your app multiple times on the same page you have to create multiple apps but point the canvas and tab url to the same script.
The other way would be to add child applications directly for the user, so you can let your customers even set a customized icon. This is hard to code couse you have to use old apis (newer one doesnt support the functions anymore) and there is none to null documentation for it. (I have such an app running, if you want to see some examples drop me a note)

Facebook Open Graph without a browser

For a middleware system with internet (which works inside a set-top box) I want to develop a primitive Facebook interface where users can type their user-names and password, showing their latest notification, messages and other casual stuff on the TV screen by using the recent Facebook Graph API.
This middleware program uses Java ME to run programs (such as this simple facebook app) and it can connect to internet however it doesn't have a real web browser. Without browser it can connect to any url to retrieve the JSON response however I am not sure how to achieve authentication without a real browser.
Under this circumstances, is it possible Facebook authentication? If you think so, what approach would you suggest ?
Thanks
Facebook provides trusted partners with a private Authorization API to get an OAuth 2 token from a username / password.
A more complicated approach would be doing something similar to how Netflix enrolls a device:
device calls server to obtain a Code
device shows code on screen and directs user to go to URL on server and enter Code
server redirects user to Facebook and obtains OAuth token, user told to go back to device
device calls server with Code and obtains OAuth token
device can now make calls directly on behalf of user
According to this documentation on "Desktop Application Authentication" I don't believe your desired result is possible:
Facebook's OAuth implementation does not include explicit desktop application support. However, if your desktop application can embed a Web browser, you can add Facebook support to your application easily using the same OAuth User-Agent Flow used by JavaScript clients.
However, it is clearly possible for certain vendors to do this, since Microsoft's Xbox 360 Facebook application does exactly what you are proposing. I'd be interested to see if anyone has dug up any API for doing this that Facebook doesn't want in their most obvious documentation.
This isn't an answer but I'm trying to do the same thing. Check out this guy's blog which uses another server to proxy the requests:
cory wiles blog
If you figure it out please post a detailed answer here so I can do it to.. :)
I think it is possible though it is pretty complicated and subject to sudden changes of Facebook interface. It might break the agreement between you and Facebook.
What you do is to emulate the Facebook.
One path you have to set up a Facebook application. Once you got the authorisation from user, you can to something with Graph API.
You need to the Facebook log-in process and authorisation process. There are some capturing tools on http/https request and response. Analyse them, both header and body.
Once you know the authorisation mechanism, you can replace it with you own. Everything afterward is on Graph API.
Another path is to emulate Facebook login and message and notification process. Capturing and analysis is needed.
In the past I have used a tool called screen-scraper (full disclosure: I used to work there) to automate logging in to facebook. Basically, it imitates a browser session; it allows you to set session variables (i.e. username, password) which would then be submitted to facebook, just as if the user had submitted them in a browser.
You may not be able to use screen-scraper in your set-top box environment (although it is java-based, so it's possible it would work). Even if it doesn't, you could implement a similar strategy in java, making the HTTP calls a browser would make to load the login page and submit the user's credentials. To keep the user's info safe make sure whatever HTTP client library you use supports HTTPS.
Proxy tools and extensions like Charles, Fiddler2, Firebug, Chrome's dev tools, etc. are helpful in seeing exactly what the browser is sending to the server in requests.

how to use FB.Connect.StreamPublish

from the scarcely documented FB api, I have thus far learned that I need to do the following to get the StreamPublish working:
I am making an iframe app
setup xd_receiver.htm. DONE.
put the FeatureLoader.js.php at the top of the body tag. DONE.
configure the api key and xd_receiver.htm. DONE.
configure the connect callback URL. NOT DONE -> what URL should I specify here?
I am unable to use the function. i have a specific link which shuld call for the FB.Connect.StreamPublish function.
can someone please explain the working of this by some example?
Check out this page for complete instructions on setting up Stream Publishing for iFrame apps (or Connect pages) using FB.Connect.streamPublish():
http://thetechnicalexperience.blogspot.com/2010/02/how-to-use-fbconnectstreampublish.html
In the facebook application settings, the description is:
Your Connect site's main URL.
And that is exactly what it is, the main URL for the site where your app resides.
If your app would've been a canvas app, you could use the FBJS function FB.streamPublish, but in an iframe app you will have to use the FB.Connect.StreamPublish.
More info at http://wiki.developers.facebook.com/index.php/Facebook.streamPublish
It seems that you have a conceptual error.
Iframe apps are canvas apps, NOT Connect apps.
Canvas apps are applications that work inside the Facebook site, eg: from a tab from your profile.
Canvas apps require you to configure a callback URL, which is the URL where your application resides. You shouldn't do steps 1-3 because Facebook will proxy the calls to your application so they can send your application session information about the user (through a POST or GET params).
Connect apps are external sites, like Digg, where you must do steps 1-3, but not step 4. Steps 1-3 are required to establish a communication channel with Facebook.
Please read http://wiki.developers.facebook.com/index.php/Connect/Setting_Up_Your_Site for a step by step guide for installing Connect in your site. After you are done with it, you can call FB.Connect.StreamPublish.