Facebook Analytics Plugin
This plugin allows you to log events though facebook analytics for iOS(8+) and Android(4.0 +)
Facebook plugin:
Make sure you require the facebook plugin before facebook analytics like so
Functions:
facebookAnalytics.init(facebookAppId)
-- initialize facebook analytics
facebookAppId(string) add Facebook App Id
facebookAnalytics.debug()
--call function to enable debug mode
facebookAnalytics.setUserID(id)
--id(string) set user id for updating user properties
facebookAnalytics.setUserProperties(data)
--data(table) use to set properties like shoe size based on userId entered(with .setUserID)
There is a 100 property limit, but the following pre defined properties don't count against limit
- account_created_time -- The time when the user's account was created, as a unix timestamp.
- city -- The city in which the user lives.
- country -- The country in which the user lives.
- gender -- The gender of the user. To get consistent analytics, set this to 'm' or 'f'.
- install_source -- The source from which the user installed your app.
- language -- The user's preferred language.
- state -- The state in which the user lives.
- user_type -- The type of the user. You define the types to get the analytics results you want.
- zipcode -- The user's zip code.
facebookAnalytics.logPurchase(cost, currency)
-- cost(number)(required) the price of the item purchased
-- currency(string)(required) the currency used to make purchase
facebookAnalytics.logEvent(eventName, valueToSum, params)
-- eventName(string)(required) the name of the event you would like to trigger
-- valueToSum(number)(optional) used for send values for thing like price of item viewed
-- params(number)(optional) other params of eventhere(App Event Schema)
facebookAnalytics.limitEventUsage()
used to limit tracking
How to setup:
Make sure you go to https://developers.facebook.com and setup and account and app (for iOS and/or Android) before using this plugin
The build.setting mirrors that of corona sdks facebook plugin, please check out there guide for iOS and Android