Hi GiL,

we want to setup Facebook App Events to track information for Facebook Analytics. They have to be setup in a script, here is example from their guide:

Example 2: Track the amount of credits spent

In the second example we keep track of how many credits a person spent. numGold is the number of in-app currency the user spent in this purchase, storeItem is a string naming the item the user bought.

var softPurchaseParameters = new Dictionary();
softPurchaseParameters["mygame_purchased_item"] = storeItem;

As a non-coder, I don't really understand, what I have to change there. E.g. We have a currency.0 named Gold. And I don't think, that for Weapons/Armor, I can only write that their Strings...So, how do I write the script correctly, so that ORK will send Facebook SDK the valid data?
  • Or more important, an example of notification to Facebook Analytics about finished tutorial:
    * For more details, please take a look at:
    * developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
    - (void)logCompletedTutorialEvent :(NSString*)contentId
    success :(BOOL)success {

    NSDictionary *params =
    [[NSDictionary alloc] initWithObjectsAndKeys:
    contentId, FBSDKAppEventParameterNameContentID,
    [NSNumber numberWithInt:success ? 1 : 0], FBSDKAppEventParameterNameSuccess,

    [FBSDKAppEvents logEvent: FBSDKAppEventNameCompletedTutorial
    parameters: params];

    * This function assumes logger is an instance of AppEventsLogger and has been
    * created using AppEventsLogger.newLogger() call.
    public void logCompletedTutorialEvent (String contentId, boolean success) {
    Bundle params = new Bundle();
    params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, contentId);
    params.putInt(AppEventsConstants.EVENT_PARAM_SUCCESS, success ? 1 : 0);
    logger.logEvent(AppEventsConstants.EVENT_NAME_COMPLETED_TUTORIAL, params);

    * Include the Facebook namespace via the following code:
    * using Facebook.Unity;
    * For more details, please take a look at:
    * developers.facebook.com/docs/unity/reference/current/FB.LogAppEvent
    public void LogCompletedTutorialEvent (string contentId, bool success) {
    var parameters = new Dictionary();
    parameters[AppEventParameterName.ContentID] = contentId;
    parameters[AppEventParameterName.Success] = success ? 1 : 0;

    Can I just save this script as it is and run it from the Call Function node in one of our ORK Events, when our tutorial reaches end?
  • As long as you have a C# script with functions that ORK can call, you're able to fire them through the function nodes.
    The script would either have to be a component attached to a game object or provide static functions to call.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.