Facebook Analytics for PC Games

Our C++ SDK for Games allows you to send custom app events to track player trends on Facebook Analytics.

Sending Custom App Events from C++

You can log app events for Facebook Analytics via the following functions:

  fbg_LogAppEvent(
    const char *eventName,
    const fbgFormDataHandle formData
  );
    
  fbg_LogAppEventWithValueToSum(
    const char *eventName,
    const fbgFormDataHandle formData,
    float valueToSum
  );
    
  fbg_ActivateApp();
  

You can log event data via creating your own key/value pairs. To do so, you should use the following API to work with the fbgFormDataHandle data structure:

    // Creates a new form data structure and returns a handle
    // to the structure
    // This will need to be disposed explicitly using 
    // fbg_FormData_Dispose()
    void fbg_FormData_CreateNew();

    // Sets a key/value pair in the provided fbgFormDataHandle
    void fbg_FormData_Set(
      const fbgFormDataHandle obj,
      char *fieldNameBuffer,
      size_t fieldNameBufferIn,
      char *valueBuffer,
      size_t valueBufferIn
    );

    // Returns 0 if an invalid handle is provided.
    // If provided buffer size is not large enough returns
    // buffer size necessary.
    // Otherwise returns the size written to the buffer.
    // Writes the value of the form data if it exists to the value buffer	
    size_t fbg_FormData_Get(
      const fbgFormDataHandle obj,
      char *fieldNameBuffer,
      size_t fieldNameBufferIn,
      char *valueBuffer,
      size_t valueBufferIn
    );

    // Deletes a key from the provided fbgFormDataHandle
    void fbg_FormData_Delete(
      const fbgFormDataHandle obj,
      char *fieldNameBuffer,
      size_t fieldNameBufferIn
    );

    // Returns true if the form data structure contains the key passed in
    // otherwise returns false
    bool fbg_FormData_Has(
      const fbgFormDataHandle obj,
      char *fieldNameBuffer,
      size_t fieldNameBufferIn
    );

    // Frees the memory allocated to the provided fbgFormDataHandle
    void fbg_FormData_Dispose(
      const fbgFormDataHandle obj
    );