user1580447
user1580447

Reputation: 1

how to capture where facebook user clicked to install my app

Here is a scenario to explain my question:

Lets say the app is a simple "suggestion box." The company installs the app and adds it to their facebook page. Then a user sees it and decides to leave a suggestion.

Once they click on the app, the app will ask to be authorized. Once they authorize it, I have no trouble sending their FB username to my server.

But how can I capture the user id of the company on whose page they first clicked on the app before they installed it?

I want the app to capture both the username of the person who is authorizing it, and the username of the person on whose page he click on the app.

Some users may install the app from the app center directly, in which case this field may be blank, but every time someone clicks on the app on someone's facebook page, I need both pieces of information to go to the server.

Any ideas?

Upvotes: 0

Views: 126

Answers (1)

Lix
Lix

Reputation: 47956

You'll be able to find this information in the signed_request passed to your application. It contains a page parameter that contains information about the page that the application is installed on. If the page exists, then the user is accessing your application from a page tab, if not, it would be safe to assume that the user is interacting with the application on its canvas url - https://apps.facebook.com/yourAppNamespace

Facebook Signed Requests -
A signed_request parameter is used by Facebook to pass data to an application in a number of different scenarios...

Upvotes: 1

Related Questions