Tuesday, April 5, 2011

Passing data into a facebook iframe app

When you send someone to your facebook app, you probably want to be able to track that referral. Obviously, since your app runs in an iframe, you can't see the parameters that were used to reach the parent page.

Fortunately, facebook allows you to get data sent into your application. Add the parameter "app_data" to the url that is used to reach your page...

http://www.facebook.com/pages/My-Great-Page/1...1?sk=app_3...9&app_data=213

Now, use the method in my last post to access the signed request and you can find your referral information in

data["app_data"]

Whew! Another coding disaster averted.

1 comment:

Anonymous said...

You just save me a few hours. THANK YOU!