Game Analytics Integration - Ios

Discussion in 'How Can I...?' started by Benfont, Sep 28, 2017.

  1. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    Hello guys,

    Please find below the method I found that works best to implement Game Analytics on your BB game for iOS only. I still have not tried it on Android. But when I finally do, if there is still no tutorial in the forums for that, then I will create it when I have some time.

    If you find a mistake on the tutorial or have a different and better way of doing the implementation please let me know in the comments so I can edit the post.


    ** STEP 1** (Account and app creation on Game Analytics)

    * Go to https://go.gameanalytics.com/ and register an account with them - it is free of charge and quite easy to create.
    * Add your game to your account by clicking on "add game" on the home page.

    upload_2017-9-28_18-1-28.png

    In this case we are calling the game "Buildbox Tutorial" .

    [​IMG] upload_2017-9-28_17-53-27.png


    f your game is already on the App Store then press search after typing its name. If it's not live on the store, then press "my game is not available on the App Store"

    Then the site is going to ask you to select the platform of your game, in this case we are choosing iOS - then press "next"
    upload_2017-9-28_17-55-43.png

    Then you are going to get to this screen:
    upload_2017-9-28_18-3-37.png
    In here you must use the same bundle ID that you have in your BB project and also on your iTunes connect app project.
    Add an icon if you already have one (not compulsory - but it will help you track better the app once you have more than one in the analytics tool)

    We press next again, and we are going to get to the following screen:

    In here just pick the genres of your game and press "add a game",
    upload_2017-9-28_18-5-10.png


    In this screen you are going to be able to display the "Game Key" and also the "Secret Key",
    Both of those keys are important for the implementation of the code in your app.
    upload_2017-9-28_18-7-14.png
    Finally we click on iOS and the following screen will appear showing us again our Game Key and Secret Key and also giving us the link to download the SDK which will be implemented in your game.

    Download the SDK folder and place it on your desktop.

    upload_2017-9-28_18-13-35.png


    **END OF STEP 1 **

    The next post will be about the implementation of the SDK on xcode
     

    Attached Files:

    wcgames, Christoph and whitedogapp like this.
  2. whitedogapp

    whitedogapp Avid Boxer

    Joined:
    Oct 8, 2015
    Messages:
    295
    Likes Received:
    72
    when will be next step??
     
    AppNasty likes this.
  3. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    ** STEP 2 ** Xcode implementation:

    1) Export your BB project to iOS
    2) Open your xcode project:

    upload_2017-9-28_18-28-0.png

    3) Resize the xcode screen so you can also display the desktop - you are going to need to drag some items from the desktop to your xcode project, so this will be handy for the implementation. If you have two screens then ignore this part.

    4) Open the GA SDK that you placed earlier on your desktop:
    upload_2017-9-28_18-31-45.png

    5) Create a subfolder on your "iOS" to place there the SDKs from GA, and also to keep things tidy
    Right click on the iOS folder and select "New group" and name it Game Analytics
    upload_2017-9-28_18-39-47.png

    6) Go to your desktop and open the GA SDK folder you placed there earlier, and go to the Library folder.
    Then you are going to drag the two files that appear in the library folder and you are going to place them inside your xcode, just in the folder you previously created:
    The files are called:
    “GameAnalytics.h” and “libGameAnalytics.a”

    upload_2017-9-28_18-42-23.png

    When you drop the files to your xcode project, the following pop up window will appear and you are going to tick "Copy items if needed" - please be sure you are ticking that box - IMPORTANT
    And then press "finish"
    upload_2017-9-28_18-43-51.png

    If you did the previous steps correctly this is how your folders menu on xcode should look like:
    upload_2017-9-28_18-46-48.png
    Then go to Build Phases and click "Link Binary with Libraries"

    upload_2017-9-28_18-50-46.png


    The menu will drop down.
    Scroll all the way down until you see the following plus sign,
    upload_2017-9-28_18-52-20.png
    Click on that plus sign, and then add the following libraries (type them down) until they appear, select them and then click "add"

    •AdSupport.framework
    •SystemConfiguration.framework
    •libsqlite3.tbd
    •libz.tbd

    upload_2017-9-28_18-53-28.png

    After you have added those 4 frameworks, click again on the plus sign and then click on "Add Other..."
    upload_2017-9-28_18-56-44.png

    A pop up will appear asking you where to look for that other framework.
    Then navigate to the GA SDK that you previously placed on your desktop and find "libGameAnalytics.a" and click OPEN,

    ** STEP 2 to be continued in the following post as I can only upload up to 10 images per post, and I have reached the limit**
     
  4. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    ** CONTINUATION OF STEP 2** - xcode implementation

    Now you need to find the item called: "AppController.mm" and click on it,
    Then add the following line to the code:
    #import "GameAnalytics.h"

    upload_2017-9-28_19-9-32.png


    And finally we are going to copy the code that is going to let our game to initiate the SDK once our game has been launched on a device.

    To do so, scroll down on the "AppController.mm" page until you find the following lines of code:
    upload_2017-9-28_19-11-40.png

    Then click on the line just above the "return YES;" and press the enter key a few times, so you make space for the code we are going to paste
    upload_2017-9-28_19-12-26.png

    Then paste the code provided by Game Analytics which contains your Game Key and Game Secret,
    In our case the code is the following:
    *sorry for the emojis appearing here - there is no way to remove them. Copy the code from this link better*
    https://www.gameanalytics.com/docs/ios-sdk

    // GAME ANALYTICS: Enable implementation log (disable in production)
    [GameAnalyticssetEnabledInfoLog:YES];
    [GameAnalyticssetEnabledVerboseLog:YES];

    // Set build version (Objective-C)
    [GameAnalyticsconfigureBuild"1.0"];
    // Initialize (Objective-C)
    [GameAnalyticsinitializeWithGameKey:mad:"6139563102439f60cfb5f72f0384663c"gameSecret:mad:"4baa87cd2878390c85242c1c6e3c7fe65ec65400"];

    upload_2017-9-28_19-15-10.png
    Note 1: the build version in this case is 1.0 but I put a screenshot with that set as 2.0 instead, sorry about that mistake
    Note 2: the game key and game secrets change from game to game, so please be sure you are using your own keys in your project.
    You can find your own keys on the app menu of GA (check step 1 on how to get those)
    upload_2017-9-28_19-16-56.png

    After that is done, you can build your game and open the app on your phone.

    ** END OF STEP 2**

    Notes:

    After you have implemented the code in your game. Launch the game and play it for a few seconds, then go to the game's dashboard to display the analytics of your game.
    If everything is correctly implemented then you should see (after 15 mins or so) the following screen with values other than zero:

    upload_2017-9-28_19-37-20.png
     

    Attached Files:

    Last edited: Sep 28, 2017
    Danlespect, wcgames and Christoph like this.
  5. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    Message to the admins: it would be nice to remove the emojis automatically popping on what we type because sometimes we need to type down some lines of codes and they make everything more complicated. Thanks
     
  6. whitedogapp

    whitedogapp Avid Boxer

    Joined:
    Oct 8, 2015
    Messages:
    295
    Likes Received:
    72
    Did you tested works every thing fine?
     
  7. whitedogapp

    whitedogapp Avid Boxer

    Joined:
    Oct 8, 2015
    Messages:
    295
    Likes Received:
    72
    and some publishers need to integrate facebook sdk and analytics, did you know how??
     
  8. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    Yes @whitedogapp everything works fine with the integration, actually the last screenshot was from the GA's site showing that there is one active device, so yes - it is working.
    And regarding the facebook SDKs = yes I have implemented those too. But I have no notes on that, I have followed step by step the tutorial on the facebook's site. Follow this document step by step doing exactly what they say and you too are going to be able to implement it.
    https://developers.facebook.com/docs/ios/getting-started

    Good luck!
     
    Christoph likes this.
  9. whitedogapp

    whitedogapp Avid Boxer

    Joined:
    Oct 8, 2015
    Messages:
    295
    Likes Received:
    72
    and publisher told me that they want (integrate basic setting and Facebook analytics) with this tutorial this things automaticaly will be integrated?
     
  10. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    hey @whitedogapp

    This tutorial I wrote is only for the Game Analytics integration on iOS.
    The FB integration is a different process, you have to integrate those SDKs following the procedures mentioned in the documentation provided in the following link:
    https://developers.facebook.com/docs/ios/getting-started

    I have implemented those FB SDK on iOS before, and it is quite straight forward. I just followed the procedures mentioned in their site. I have no notes on that of my own so I cannot help you much with that.
    Just follow the steps mentioned on their site and you should be fine. Go carefully step by step..

    I am sorry I cannot help you further,

    Cheers,
     
    Christoph likes this.
  11. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    You can use the code quotes to put code in the post.

    Thanks again for the tutorial.
     
    Benfont likes this.
  12. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    Hey @Christoph I was not aware we could do that - I tried to do it but I could not fix it. Please let me know how to do it when you have a sec so I can edit the post!
    thanks!
     
  13. whitedogapp

    whitedogapp Avid Boxer

    Joined:
    Oct 8, 2015
    Messages:
    295
    Likes Received:
    72
    Do you have Eclipse tutorial?
     
  14. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    Sorry man, I have not implemented GA on other platforms but iOS @whitedogapp
     
  15. whitedogapp

    whitedogapp Avid Boxer

    Joined:
    Oct 8, 2015
    Messages:
    295
    Likes Received:
    72
    I implemented ios how much time it need to see data?
     
  16. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    it takes about 15 mins or so..
     
  17. whitedogapp

    whitedogapp Avid Boxer

    Joined:
    Oct 8, 2015
    Messages:
    295
    Likes Received:
    72
    gone more than 30 mins nothing is shown
     
  18. whitedogapp

    whitedogapp Avid Boxer

    Joined:
    Oct 8, 2015
    Messages:
    295
    Likes Received:
    72
    did i need use this words in code Objective-c??? i saw tutorial on site there is without that?
     
  19. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    hey there, if the numbers are not changing from zero then you did something wrong
    The whole tutorial is written for Objective-C, I have not tried it on Swift yet.
    Follow step by step of the tutorial and you are going to be able to make it man.
    Good luck!
     
  20. whitedogapp

    whitedogapp Avid Boxer

    Joined:
    Oct 8, 2015
    Messages:
    295
    Likes Received:
    72
    not swift I am using Xcode too, in numbers you mean Analytics numbers?? they still zero
     

Share This Page