Please help me with SDKBOX Google Analytics

Please help me with SDKBOX Google Analytics
0

#1

Hi All,

I am trying to get sdkbox working on eclipse windows.
I first transfered my test project to IOS, ran the sdkbox installer .

Afterwards copied the whole project back to windows

In eclipse i merged the version.cml in res\version.config

When i modify my cocos2dxxActivity.java the import for import com.sdkbox.plugin.SDKBox cannot be resolved.

How do i Add the library / project to eclipse?

I am a windowsbased developer myself and not reallyu comfortably with the eclipse /ios builder / linker and build processes. Can somebody help me out here? How do i make import com.sdkbox.plugin.SDKBox; available in my project?


#2

Did the installer run successfully?

What version of cocos2d-x are you using?

com.sdkbox.plugin.SDKBox is in sdkbox.jar can you see if your project contains this file? If it is can you post it’s path?


#3

Hi Nite,

My project did not contain the sdkbox files, or at least the part i copied from osx to my windows machine did not. I copied them by hand. Now i still have issues, but i guess that is mainly because of some errors i made in the process before.

What i am going to do now is restore my backup on windows machine (which is untill now my main development machine). I will get win32, win universal and android version using eclipse working without the SDKBOX / Google analytics.

I will copy the project to my MacMini, run the SDKBOX installer there and copy the whole lot back to windows.

After that I will follow remaining steps in the help files. I will get to this tomorrow and keep you uipdated. Thanks for the reply.

And… Is there also a solution where I can run the SDKBOX installer from windows?


#4

You should be able to run sdkbox from windows, the down side is that it will not change the Xcode project, so you’ll have to integrate it manually later.


#5

Hi @nite,

By now i seem to got it working.
How i did it / what i did / can remember right now:

Base situation was that I developed a project in visual studio, I test on Win32, also got the windows phone project working and the android version using eclipse on win32.

I copied my project files to a networkshare. On my Mac I copied the files back and ran the sdkbox installer… This result was copied back to networkshare --> windows.

I had te delete and recreate a few files since OSX added copies of files in my folder starting with ._ . . Also my .cocosprject file appeared to be deleted, i had to recreate it.

I had to manually add the googleplayservices library from my android sdk folder to the eclipse solution and a a reference to this library. Also i had to copie the reference into my workspace (different disks) I don’nt know the reason why, but otherwise it just did not work. I changed the Coco2dAppactivity init procedures as described in the manual and changed the sdkbox config.

furthermore I noticed i takes quite a while until results are displayed in Google Analytics. Is there anything I can do to change this? The dispatch timeout in the documentaion says the interval is in seconds, other references say in minutes. What happens if for example my dispatchinterval is 10 minutes but i close the app in 5 minutes. Will the results be posted on the next run?

Thanks so far for all the help.

ps.) The sdkbox windows installer has got a few issues and requirements. One of the is that i have to have my project directory on the same install disk as my python installation? And as you sais the ios version is not working. Maybe these issues can be addressed in future development?


SDKBOX FAQ Post
Samples, Roadmap and FAQ
#6

Google analytics has a long delay before you can see your events, I think after couple days (after you create the GA app) it do gets better.

Yes, we’ll keep fixing the windows version.


#7

hi @nite,

Google Analytics works fine on iOS, but nothing happens on android…
I follow all the different steps from the wiki, I haven’t got any Error Message but nothing happens. I double and triple check if my trackingCode was correct.
For iOS, I’ve got a LOG saying “GoogleAnalytics plugin” after calling PluginGoogleAnalytics::init(); , but I’ve got nothing for android.
Do you have any idea what I have done wrong?

I’m using the latest version of googleanalytics and sdkbox.


#8

Can you try this sample and see if it works with your tracking id?
https://github.com/chukong/sdkbox-ga-sample


#9

I didn’t try the sample yet but I just import the new pluginGoogleAnalytics and now I’ve got this:

09-30 18:02:46.702: I/GAv4(16648): Google Analytics 7.5.71 is starting up. To enable debug logging on a device run:
09-30 18:02:46.702: I/GAv4(16648):   adb shell setprop log.tag.GAv4 DEBUG
09-30 18:02:46.702: I/GAv4(16648):   adb logcat -s GAv4
09-30 18:02:46.722: W/GAv4(16648): AnalyticsReceiver is not registered or is disabled. Register the receiver for reliable dispatching on non-Google Play devices. See http://goo.gl/8Rd3yj for instructions.
09-30 18:02:46.722: W/GAv4(16648): CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See http://goo.gl/8Rd3yj for instructions.
09-30 18:02:46.732: W/GAv4(16648): AnalyticsService not registered in the app manifest. Hits might not be delivered reliably. See http://goo.gl/8Rd3yj for instructions.

So I add those lines in my AndroidManifest.xml (thanks to this post ) :

<!-- Optionally, register AnalyticsReceiver and AnalyticsService to support background
      dispatching on non-Google Play devices -->
 <receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
     android:enabled="true">
     <intent-filter>
         <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
     </intent-filter>
 </receiver>
 <service android:name="com.google.android.gms.analytics.AnalyticsService"
     android:enabled="true"
     android:exported="false"/>

 <!-- Optionally, register CampaignTrackingReceiver and CampaignTrackingService to enable
      installation campaign reporting -->
 <receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
     android:exported="true">
     <intent-filter>
         <action android:name="com.android.vending.INSTALL_REFERRER" />
     </intent-filter>
 </receiver>
 <service android:name="com.google.android.gms.analytics.CampaignTrackingService" />

and it works!

However, google analytics is not called each time I open the game…

EDIT: In fact, it works only one time… now even with the modified Manifest I have the same errors (AnalyticsReceiver, CampaignTrackingReceiver, AnalyticsService,…)


#10

I’m having the same issue, GA working ok on iOS but on Android I have the same warning in the log and cannot get any tracking working.

This is supposed to be easy with SDKBOX and it is not. I’m sure I am not the only one who has spent hours/days trying to figure out what is going on (not only GA but Facebook plugin has been equally difficult). And unlike the rest of cocos2d-x which is open source so we can see what is going on, this closed source model for SDKBOX creates extra frustration.


#11

That’s a confirmed issue, we’re looking into that, will fix it for the Oct 14 release.


#12

Installation Successful :slight_smile:
[Errno 2] No such file or directory: ‘C:\CocosProjects\Kelimece\cocos2d\cocos\platform\android\java\libs\facebook_lib\src\org\cocos2dx\lib\Cocos2dxActivity.java’
Installation failed :frowning:
This error fails my sdkbox installations.


#13

proj.android\AndroidManifest.xml:19: error: Error: No resource found that matches the given name (at ‘value’ with value ‘@integer/google_play_services_version’).


#14

There is a bug with current version of the installer, we’re working on it.

At the meantime, can you try integrate google analytics manually, following this guide.
http://docs.sdkbox.com/en/plugins/googleanalytics/v3-cpp/#manual-integration


#15

Well i got it integrated successfully, followed [sdkbox-sample-ga][1] but analytics data is not being tracked by google. That was a new tracker id i created in the beginning(created 3 days ago) then i changed it with an existing-working tracker id to confirm my google analytics installation works properly but unfortunately it’s not too. What is missing here?[1]: https://github.com/sdkbox/sdkbox-sample-ga


#16

Hello @hgokturk

We will check and let you know, if there’s an issues with the current plugins.


#17
Copyright (c) 2015 SDKBOX Inc. v1.0.0.2
 installed packages:
     v2.0.0.2 googleanalytics
     v2.0.0.2 review
     v2.0.0.2 facebook
     v2.0.0.2 googleplayservices
     v2.0.0.2 iap

project.properties

target=android-15

android.library.reference.1=../cocos2d/cocos/platform/android/java
android.library.reference.2=../cocos2d/cocos/platform/android/java/libs/facebook_lib/
android.library.reference.3=../cocos2d/cocos/platform/android/java/libs/gps/
android.library.reference.4=plugin_review_res_project/

sdkbox_config.json

 {
        "android": {
            "GoogleAnalytics": {
                "trackingCode": "sample code"
            }, 
            "Review": {
                "LaunchLimit": 3,
                "DayForReminding": 1,
                "tryPromptWhenInit": true,
                "DayLimit": 0,
                "LaunchForReminding": 2,
                "UserEventLimit": 0
            }, 
            "Facebook": {
                "debug": true
            }, 
            "iap": {
                "items": {
                    "remove_ads": {
                        "type": "non_consumable", 
                        "id": "com.cocos2dx.non1"
                    }, 
                    "double_coin": {
                        "type": "non_consumable", 
                        "id": "com.cocos2dx.non2"
                    }, 
                    "coin_package": {
                        "id": "com.cocos2dx.plugintest2"
                    }, 
                    "coin_package2": {
                        "id": "com.cocos2dx.plugintest3"
                    }
                }, 
                "key": "sample key"
            }
        }, 
        "ios": {
            "GoogleAnalytics": {
                "trackingCode": "UA-62417901-1"
            }, 
            "Review": {
                "LaunchLimit": 3, 
                "DayForReminding": 1, 
                "tryPromptWhenInit": true, 
                "AppID": "587767923", 
                "DayLimit": 0, 
                "LaunchForReminding": 2, 
                "UserEventLimit": 0
            }, 
            "Facebook": {
                "debug": true
            }, 
            "iap": {
                "items": {
                    "remove_ads": {
                        "type": "non_consumable", 
                        "id": "com.cocos2dx.non1"
                    }, 
                    "double_coin": {
                        "type": "non_consumable", 
                        "id": "com.cocos2dx.non2"
                    }, 
                    "coin_package": {
                        "id": "com.cocos2dx.plugintest2"
                    }, 
                    "coin_package2": {
                        "id": "com.cocos2dx.plugintest3"
                    }
                }
            }
        }
    }

AndroidManifest.xml

<?xml version='1.0' encoding='UTF-8'?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.dreals.x" android:installLocation="auto" android:versionCode="1" android:versionName="1.0">
    <uses-sdk android:minSdkVersion="15" />
    <uses-feature android:glEsVersion="0x00020000" />
    <application hardwareAccelerated="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
        <meta-data android:name="android.app.lib_name" android:value="cocos2dcpp" />
        <activity android:configChanges="orientation" android:label="@string/app_name" android:name="org.cocos2dx.cpp.AppActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" />
        <provider android:authorities="com.facebook.app.FacebookContentProvider........" android:exported="true" android:name="com.facebook.FacebookContentProvider" />
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
        <meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/global_tracker" />
        <receiver android:enabled="true" android:name="com.google.android.gms.analytics.AnalyticsReceiver">
            <intent-filter>
                <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
            </intent-filter>
            <intent-filter />
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
            <intent-filter />
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
            <intent-filter />
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>
        <service android:enabled="true" android:exported="false" android:name="com.google.android.gms.analytics.AnalyticsService" />
        <receiver android:exported="true" android:name="com.google.android.gms.analytics.CampaignTrackingReceiver">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>
        <service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
        <provider android:authorities="com.facebook.app.FacebookContentProvider_replace_with_your_app_id_" android:exported="true" android:name="com.facebook.FacebookContentProvider" />
    </application>
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.android.vending.BILLING" />
</manifest>

Followed sdkbox github samples, but don’t know why not working for me. Anything wrong with these above?


#18

Hello @hgokturk

  • It seem to have some issues with your AndroidManifest.xml

Please take backup of your current file and replace the entire content with this -

<?xml version='1.0' encoding='UTF-8'?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.dreals.x" android:installLocation="auto" android:versionCode="1" android:versionName="1.0">
    <uses-sdk android:minSdkVersion="15" />
    <uses-feature android:glEsVersion="0x00020000" />
    <application hardwareAccelerated="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
        <meta-data android:name="android.app.lib_name" android:value="cocos2dcpp" />
        <activity android:configChanges="orientation" android:label="@string/app_name" android:name="org.cocos2dx.cpp.AppActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" />

        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" />
        <provider android:authorities="com.facebook.app.FacebookContentProvider........" android:exported="true" android:name="com.facebook.FacebookContentProvider" />

        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
        <meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/global_tracker" />
        <receiver android:enabled="true" android:name="com.google.android.gms.analytics.AnalyticsReceiver">
            <intent-filter>
                <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
            </intent-filter>

        </receiver>
        <service android:enabled="true" android:exported="false" android:name="com.google.android.gms.analytics.AnalyticsService" />


        <receiver android:exported="true" android:name="com.google.android.gms.analytics.CampaignTrackingReceiver">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
        </receiver>
        <service android:name="com.google.android.gms.analytics.CampaignTrackingService" />




        <provider android:authorities="com.facebook.app.FacebookContentProvider_replace_with_your_app_id_" android:exported="true" android:name="com.facebook.FacebookContentProvider" />
    </application>
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.android.vending.BILLING" />
</manifest> 
  • It seems to have issue with your sdkbox_config.json also -

please replace the tracking code value as you did in the iOS part.
or else it will not work in Android.

Please let us know after making these changes, whether it works for you or not.

Best,
Pabitra


#19

Thank you for your help @pabitrapadhy. This is frustrating, i’m exhausted you know :smiley: Nope, can’t get a bit of a signal from google analytics no matter what we try :smile:


#20

Hello @hgokturk

We are sorry to hear that.
However we have checked the plugins properly for their functionality.

Could you please PM me your code or any sample app pertaining the issue, so that we could check what’s wrong with it. !! As that would be easy for us to debug the issue.

Expecting your support. :smile:

Best,
Pabitra