GameAnalytics / GA-SDK-CPP

Repository for GameAnalytics C++ SDK.
MIT License
21 stars 16 forks source link

Travis

GA-SDK-CPP

GameAnalytics C++ SDK

Documentation can be found here.

Supported platforms:

Dependencies

Changelog

3.2.6

3.2.5

3.2.4

3.2.3

3.2.2

3.2.1

3.2.0

3.1.3

3.1.2

3.1.1

3.1.0

3.0.8

3.0.7

3.0.6

3.0.5

3.0.4

3.0.3

3.0.2

3.0.1

3.0.0

2.1.9

2.1.8

2.1.7

2.1.6

2.1.5

2.1.4

2.1.3

2.1.2

2.1.1

2.1.0

2.0.4

2.0.3

2.0.2

2.0.1

2.0.0

1.4.6

1.4.5

1.4.4

1.4.3

1.4.2

1.4.1

1.4.0

1.3.8

1.3.7

1.3.6

1.3.5

1.3.4

1.3.3

1.3.2

1.3.1

1.3.0

1.2.4

1.2.3

1.2.2

1.2.1

1.2.0

1.1.1

1.1.0

1.0.1

1.0.0

How to build

To start a build for all supported targets simply call

Mac/Linux: ./build.sh

Windows: build.bat (must be run as administrator when building for Tizen). By default the build script tries to use Visual Studio 2017 to use Visual Studio 2015 call build.bat -v 2015

This will build all targets and first time intall CMake and Tizen SDK.

Or call build.bat -h or ./build.sh -h to display the usage of the script and it will list all available targets.

To build just a specific target call command with argument -t (available targets can be shown calling with -h argument).

How to develop

If you developing the SDK, you can use the generated project files to work with.

They are located under build/jenkins/build/[target] after calling the build.sh or build.bat.

Folderstructure

Lib Dependencies

as source means the dependency will be compiled with the project itself, as binary means the dependency is prebuild and will be linked to the project

Preperation before usage of the SDK

Usage of the SDK

Remember to include the GameAnalytics header file wherever you are using the SDK:

 #include "GameAnalytics.h"

Custom log handler

If you want to use your own custom log handler here is how it is done:

void logHandler(const char *message, gameanalytics::EGALoggerMessageType type)
{
    // add your logging in here
}

gameanalytics::GameAnalytics::configureCustomLogHandler(logHandler);

Configuration

Example:

 gameanalytics::GameAnalytics::setEnabledInfoLog(true);
 gameanalytics::GameAnalytics::setEnabledVerboseLog(true);

 gameanalytics::GameAnalytics::configureBuild("0.10");

 {
     std::vector<std::string> list;
     list.push_back("gems");
     list.push_back("gold");
     gameanalytics::GameAnalytics::configureAvailableResourceCurrencies(list);
 }
 {
     std::vector<std::string> list;
     list.push_back("boost");
     list.push_back("lives");
     gameanalytics::GameAnalytics::configureAvailableResourceItemTypes(list);
 }
 {
     std::vector<std::string> list;
     list.push_back("ninja");
     list.push_back("samurai");
     gameanalytics::GameAnalytics::configureAvailableCustomDimensions01(list);
 }
 {
     std::vector<std::string> list;
     list.push_back("whale");
     list.push_back("dolphin");
     gameanalytics::GameAnalytics::configureAvailableCustomDimensions02(list);
 }
 {
     std::vector<std::string> list;
     list.push_back("horde");
     list.push_back("alliance");
     gameanalytics::GameAnalytics::configureAvailableCustomDimensions03(list);
 }

Initialization

Example:

 gameanalytics::GameAnalytics::initialize("<your game key>", "<your secret key");

Send events

Example:

 gameanalytics::GameAnalytics::addDesignEvent("testEvent");
 gameanalytics::GameAnalytics::addBusinessEvent("USD", 100, "boost", "super_boost", "shop");
 gameanalytics::GameAnalytics::addResourceEvent(gameanalytics::Source, "gems", 10, "lives", "extra_life");
 gameanalytics::GameAnalytics::addProgressionEvent(gameanalytics::Start, "progression01", "progression02");