Start now

Step 1: Register an Account

registered:

If you don't have a TapDB account, please go first Home Application

Verify Email:

You must use TapDB after verifying your mailbox. The email is valid for 7 days. If you can't receive the email, you can try to resend the email or change to another email address.

Step 2: Create a Business and Project

Create a Business:

Entering TapDB for the first time will require you to create a business. You need to provide the company name and company LOGO (not required).

Create a project:

After the business is successfully created, you can create your game project under the Games interface. Creating a project requires the project name and project icon (not required). If your game supports multiple platforms, you only need to create one project. After the creation is complete, an APPID is assigned and the ID is used for SDK integration.

Note: iOS and Android share this APPID.

Step 3: SDK Integration

Download the SDK:

Currently TapDB supports iOS and Andriod platform games.

Download the SDK

Integrated SDK:

iOS and Android share an APPID.

iOS Access Guide

Android Access Guide

Step 4: Commissioning

Debug Data:

After the game installation package is integrated with TapDB, a networked device is required to download and open the game. If the background receives the activation data, then the project can be converted into an official game. After the game is converted to an official game, the test data will be deleted without affecting the formal data.

If the background receives no data, you can:

  • Check whether the test equipment is connected
  • Check if APPID is entered correctly
  • Reopen the game client and see if the data is received
  • If all of the above methods are invalid, please pass Work Order Contact us

SDK文档

现在开始

第一步:注册账号

注册:

如果您还没有TapDB账号,请先前往 首页 申请

验证邮箱:

您必须在验证邮箱后才能使用TapDB。邮件的有效期为7天。 如果收不到邮件,您可以尝试重新发送邮件或者换一个邮箱。

第二步:创建企业和项目

创建企业:

首次进入TapDB,会要求您创建企业,您需要提供企业名称和企业LOGO(非必须)。

创建项目:

企业创建成功后,您可以在「游戏」界面下创建您的游戏项目。 创建项目需要提供项目名称和项目icon(非必须),如果您的游戏支持多个平台,也只需要创建一个项目即可。 创建完成后会分配一个APPID,使用该ID来进行SDK集成步骤。

注意:iOS和Android共用此APPID。

第三步:SDK集成

下载SDK:

目前TapDB支持iOS与Andriod平台的游戏。

下载SDK

集成SDK:

iOS、Android共用一个APPID。

iOS接入指南

Android接入指南

第四步:调试

调试数据:

游戏安装包集成完TapDB后,需要一台联网设备下载并打开游戏,如果后台接收到了激活数据,那么就可以把项目转为正式游戏,转为正式游戏后,测试数据将被删除,不影响正式数据。

如果后台接收不到数据,您可以:

  • 检查测试设备是否联网
  • 检查APPID是否输入正确
  • 重新打开游戏客户端,查看数据是否接收到
  • 如果上述办法都无效,请通过 工单 和我们联系

現在開始

第一步:註冊賬號

註冊:

如果您還沒有TapDB賬號,請先前往 首頁 申請

驗證郵箱:

您必須在驗證郵箱後才能使用TapDB。郵件的有效期爲7天。 如果收不到郵件,您可以嘗試重新發送郵件或者換一個郵箱。

第二步:創建企業和項目

創建企業:

首次進入TapDB,會要求您創建企業,您需要提供企業名稱和企業LOGO(非必須)。

創建項目:

企業創建成功後,您可以在「遊戲」界面下創建您的遊戲項目。 創建項目需要提供項目名稱和項目icon(非必須),如果您的遊戲支持多個平臺,也只需要創建一個項目即可。 創建完成後會分配一個APPID,使用該ID來進行SDK集成步驟。

注意:iOS和Android共用此APPID。

第三步:SDK集成

下載SDK:

目前TapDB支持iOS與Andriod平臺的遊戲。

下載SDK

集成SDK:

iOS、Android共用一個APPID。

iOS接入指南

Android接入指南

第四步:調試

調試數據:

遊戲安裝包集成完TapDB後,需要一臺聯網設備下載並打開遊戲,如果後臺接收到了激活數據,那麼就可以把項目轉爲正式遊戲,轉爲正式遊戲後,測試數據將被刪除,不影響正式數據。

如果後臺接收不到數據,您可以:

  • 檢查測試設備是否聯網
  • 檢查APPID是否輸入正確
  • 重新打開遊戲客戶端,查看數據是否接收到
  • 如果上述辦法都無效,請通過 工單 和我們聯繫

1.Docking problem

Q:How to save the userId of a stand-alone game?

A:The userId of stand-alone games needs to pay attention to the following points:

(1)iOS has to generate an ID to store it in the certificate space. iOS has a storage space, an application and a certificate (business).

(2)Android tries to save to the SD card, use a user operation or call setUser after 1 minute.

(3)A unique user ID is randomly generated and saved locally to use it later.


Q:Why is there no new data after SDK access?

A:Please check whether the SDK initialization has been successful. If there is a failure, there will be a corresponding failure log, and confirm that the initialization is the earliest call.


Q:Is the server and client required to pass recharge data?

A:The server and the client only need to select one of the two methods to transmit the recharge data. At the same time, the data will be transmitted in two, and the income will double.


Q:Why does the server's TapDB page not display revenue or income more than it actually does?

A:First, the server and the client interface can only use one of them (when used, it will record double recharge, and ensure that the recharge is successful and then send recharge data), followed by the server "identify": user_id in the "user_id" and the document "record a The "userId" in setUser in Player "s needs to be consistent.


Q:Why does TapDB show no data after real-time online data is sent?

A:There are several reasons why data may not be displayed:

(1)Check the file format, parameter type (return 400 error description format is wrong)

(2)Note the timestamp unit (seconds), and can only send data for the last 7 days, too early data will not be kept

(3)Note: Is there a mandatory header:Content-Type: application/json


Q:Can empty parameters not be filled?

A:No, you can fill in empty null parameters.


Q:Why can't I find the subcontracting channel in TapDB?

A:You must have a new data TapDB to receive this channel in order to display this subcontracting channel on this page.


2.Common problem

Q:How to view data in various dimensions?

A:There are switching options of the main dimension in the table of source, online, retention, and payment. The data displayed in each dimension is different, and the data in each dimension can be viewed according to different situations.


Q:What is the subcontracting channel?

A:The subcontracting channel is the intermodal platform, which is the platform on which the package is about to go online. This parameter is passed in the initialized channel. For example, the package is put on the App Store and the App Store is passed on. The follow-up can only look at the subcontracting channel. Data to facilitate the selection of high-quality intermodal platforms.


Q:How to use filter conditions?

A:Filtering conditions can be based on different options, different ranges to select the data displayed in the TapDB table, to facilitate the distinction between various types of users. You can add multiple filter conditions to accurately filter the data that meets the conditions, or you can save the set filter conditions to facilitate the next use.


Q:Why are the income of the source less than the actual income?

A:The source only shows the paid-income status of the newly added user. For the old user's payment status, please see the paid page.


Q:Why is the conversion rate of the game very low?

A:There may be several reasons for the low conversion rate:

(1)Technicians ensure that the SDK calls setUser when the user logs in.

(2)Operators pay attention to whether there are a large number of new devices, and there may be cheating machines that are increasing.


3.Advertising related issues

Q:How to create an advertising plan?

A:Enter TapDB,Advertisement page, click on Advertising Management, select the new advertising campaign in the upper right corner, select the advertising platform, pay attention to see the matching method, fill in the information, and generate delivery links.


Q:What is IP matching?

A:The IP matching is matched by whether the IP when the user clicks on the advertisement matches the IP when the game is opened, and applies to all advertisements. If you do not find the corresponding platform when creating an ad campaign, you can create a custom ad.


Q:What is device matching?

A:The device matching is that the TapDB and the advertising platform have been docked. The advertisement platform returns the data of the click advertisement to the TapDB, and matches the new user through the device information, which is very accurate, but is only used in an advertising platform docked with the TapDB.


Q:How to put IP matching and device matching?

A:TapDB's ad matching is divided into IP matching and device matching:

IP Matching: When you add an ad campaign, select the ad platform, the IP-matched ad platform has an annotation, and the IP-matched ad needs to fill in the download link. After the link is generated, the IP-generated ad delivery link is directly filled in the ad platform. Landing page URL can be.

IP Matching: When you add an ad campaign, select the ad platform, the IP-matched ad platform has an annotation, and the IP-matched ad needs to fill in the download link. After the link is generated, the IP-generated ad delivery link is directly filled in the ad platform. Landing page URL can be.


Q:What if I can't use TapDB's link to serve ads?

A:For example, if the domain name of the game is abc, abc needs to be resolved to l.tapdb.net in the form of CNAME, and if the connection given by TapDB is https://l.tapdb.net/xxxx, the l.tapdb is directly replaced. .net for abc, https for http, and http://abc/xxxx, use this link to post ads.


Q:Why are ads matched to players in other systems?

A:Players whose ads are matched to other systems may have the following reasons:

(1)Posted on the web, both iOS and Android users will be matched

(2)iOS delivery links, Android users (can see the ad) may click on the initiative to search for the app download, it will be matched on the same Android advertising may be matched by iOS users.

Questions often encountered when using TapDB

A solution to the problems encountered in using TapDB is provided here.

Includes docking issues, data-related issues, ad-related issues, and other issues that may be encountered.

Solution of Network Connectionless problem with TapDB

If you have a "network-free" problem, try the following solution.

Reasons

Apple added the ability to "use wireless LAN and cellular mobile applications" in iOS 10. Some App upgrades turn off data usage by default, resulting in a failure to connect to the network.

Solutions

1.Enter Settings-Cellular Mobile Networks-applications using Wireless Local area Networks and Cellular Mobile (or Settings-Wireless Local area Networks-applications using Wireless Local area Networks and Cellular Mobile), Find an app that can't be connected and allow it to "use wireless LAN and cellular mobile data."

2.There's also a bug situation: what if you can't find this app that doesn't connect to the Internet in the list? 1) at this point, select any App in the list, first turn off Wireless LAN and Cellular Mobile data, that is, do not allow it to use the data. Then reopen to allow the use of Wireless Local area Network and Cellular Mobile data. 2) go back to your desktop and open the app that you just couldn't connect to, and you'll be prompted to "allow App to use the data network" and click "allow" to connect to the network. This is mainly the case with Bank of China's iPhone, which is said not to have added "whether or not to allow" the use of wireless local area networks and cellular mobile applications, so it will not be a problem. Apple should fix this bug in a future version of iOS.

Advertising channel description

1.The TapDB AD monitoring is divided into IP matching and device matching

2.The IP matching method is the same, fill in the download link, and use the drop link generated by TapDB instead of the original download link to fill in the landing page of the advertisement platform

3.If the equipment matching is not well understood, please refer to the equipment matching of the corresponding advertising channel

Ali Huichuan

Ali Huichuan has two monitoring methods:

Method one:

Monitoring and promotion unit: Alibaba's promotion unit can only configure one conversion. If you want to monitor different promotion units, it is recommended to configure multiple conversions, one for each unit.

1.Create Alibaba's advertising campaign in TapDB and save the delivery link

Alt text

2.Fill in the delivery link of TapDB at the click-to address of Alibaba Website - Promotion Tool - Conversion Tool - App Behavior

Alt text

3.In the bidding settings set in the promotion unit, the conversion type selection is activated, and the configured conversion name can be selected

Alt text

Method two:

Monitor advertising creatives: You can configure a monitoring link for each creative to monitor the advertising effectiveness of different creatives.

1.Create Alibaba's advertising campaign in TapDB and save the delivery link

Alt text

2.Fill in the monitoring link for the TapDB monitoring link when creating the AD idea

Alt text

AppsFlyer

1.Create an AdsFlyer campaign in TapDB and save the delivery link

Alt text

2.Go to the AppsFlyer background and select the API data interface, find the Push API, add the postback, check only the non-organic of Installs, fill in the post link generated by TapDB into the postback URL, as shown in the following figure:

Alt text

Alt text

3.It should be noted that, as long as AppsFlyer configures a TapDB link and wants to see the advertising effectiveness of different channels, TapDB can create advertising campaigns for the corresponding channels, and the delivery links generated by each advertising campaign are the same.

Alt text

Tencent advertising platform

Configure one feedback URL per appid,monitor the performance of different ads

1.Create an advertisement for the Tencent advertising platform in TapDB, fill the Tencent account ID with TapDB for authorization

Alt text

2.After the authorization is successful, fill in the AppID in the Tencent background into TapDB.(Need to create an app first)

Alt text

3.Generate a feedback URL, fill the feedback URL into the Tencent background, view User action set ID in TapDB, and check whether it corresponds to the project on the DMP data management platform.

Alt text

Bytedance (Toutiao)

Bytedance (Toutiao) has two ways of advertising monitoring

Method one:

Monitor advertising plan: Bytedance (Toutiao) advertising plan can only correspond to one conversion. If you want to monitor different plans, it is recommended to configure multiple conversions, one for each plan.

1.Create a device match Bytedance (Toutiao) campaign in TapDB, save the generated delivery link (click the callback link)

Alt text

2.Open the backstage supporter of Bytedance (Toutiao), select toolbox - optimize auxiliary - transform tracking, and enter the corresponding link as shown in the figure below.

Alt text

3.Optimize your goal selection conversions when creating your ad plan, select the activation for conversion type, and choose the configured conversion name

Alt text

Method two:

Monitor advertising creativity: you can configure a monitoring link for each idea to monitor the advertising effects of different ideas.

1.Create a device-matching Bytedance (Toutiao) campaign in TapDB, save the generated delivery connection (click-callback connection), and display the link

Alt text

2.When creating an AD idea, fill in the corresponding location of the link generated by the TapDB

Alt text

Unityads

It is recommended that each advertisement be configured with a monitoring link to monitor the advertising effectiveness of different advertisements

1.Create Unityads campaigns in TapDB and save delivery links

Alt text

2.After creating an ad in Unityads’s ad background, populate the third-party tracking connection in the ad plan settings with the delivery link

Alt text

Vungle

It is recommended that each advertisement be configured with a monitoring link to monitor the advertising effectiveness of different advertisements

1.Create Vungle campaigns in TapDB and save delivery links

Alt text

2.When placing an ad in Vungle's back office, fill in the delivery link for TapDB at the tracking link

Alt text

Download SDK

By accessing the TapDB SDK, you can collect your game operations data and track your advertising performance.

If you are advertising on Tencent Social Ads、MOMO、Baidu OCPC
The compatible version supports additional acquisition of IMEI, support for monitoring of Tencent Social Ads, MOMO, Baidu OCPC, and other features consistent with the official version.
We recommend that you use a compatible version if you need to run and monitor these advertising platforms. Because getting the IMEI may cause:
  1. Involves getting user privacy
  2. The game is not available on Google Play

Function guide

Here is a guide to the use of part of the TapDB functionality.

It includes questions that developers and users will often encounter, and introduces how the functionality is used.

Update functions

The functions of the TapDB update are described here.

It includes function update and content optimization of web and mobile terminals.

2018-09-06 V1.5.2 Update log

New function

  1. Support the latest notification in the message center
  2. If you encounter problems, you can give us feedback in the settings - problem feedback
  3. Paid data add promotion cost curve
  4. Filter under source to support paid data screening

Optimization

  1. Game list yesterday data changes according to project time zone
  2. Fix the overview page today's histogram time misplacement problem
  3. Filter condition screening interaction optimization
  4. Common currency increases country logo
  5. Optimize interactions and prompts when the network environment is poor

2018-08-09 V1.5.1 Update log

New function

  1. Add DEMO entry

Optimization

  1. Fix the problem of entering the client flashback in some scenarios.

2018-07-31 V1.5.0 Update log

New function

  1. The project displays data according to the time zone of the project.
  2. When your time zone and project time zone are inconsistent, add a message.

Optimization

  1. Overall layout and detail style optimization
  2. Optimize the data display style, the red number is not satisfied; today's data is green
  3. Pull-down refresh experience optimization
  4. Filter condition page supports right slide back
  5. No network connection prompt update
  6. Fix the style problem when the form is full screen
  7. Fix the problem that the login page 1Password coincides with the clear icon
  8. Solve the problem of TouchID/FaceID lock status
  9. Fix the problem that the card is in the open screen after the app is awakened.

2018-06-11 V1.4.4 Update log

Fixed

  1. Fix bugs that cannot be pulled down and refreshed under Acquisition, Active, and Payment page

2018-06-11 V1.4.3 Update log

New function

  1. Pay-user module added 2, 4, 5, 6 day LTV data
  2. Pay-cycle module revision, support multi-day data comparison view
  3. Under the payment, support to view data by "payment method" and "product name"
  4. Active-behavior module supports viewing hourly data
  5. Added "About TapDB" to view current version and function introduction

Optimization

  1. Set the button position to the upper right corner
  2. Fingerprint unlock is displayed after being turned on
  3. Fix iOS10, iPhone6 ​​flashback problem
  4. Header content display optimization

2018-05-14 V1.4.2 Update log

New function

  1. Support the current device to be added to the test whitelist for testing new data.
  2. You can view active data by day, week and month.
  3. Add the top announcement

Optimization

  1. Improve the structure and improve the response speed of the app.
  2. Overview supports right slide back to the previous interface
  3. Chart support long press to view data
  4. Marked items are sorted by revenue

2017-12-22 V1.3.0 Update log

New function

  1. Game support top, let you find common games faster
  2. Acquisition page support for data screening based on cumulative payment, first day payment, and payment times
  3. Support submitting questions and suggestions in the settings

Optimization

  1. Game list sorted by revenue
  2. Interface layout optimization
  3. Fixed a bug in the search for incomplete filters.
  4. Display currency support VND

2017-11-15 V1.1.0 Update log

Optimization

  1. Adapt iPhoneX

2017-10-20 V1.0.0 Update log

New function

  1. Support real-time online data viewing on the Overview page and Active page
  2. View revenue data by different currency types

2018-08-03 Update log

New function

  1. Add original paid data export, which can be downloaded in the tool-data export

Fixed

  1. Filtering condition search sorting problem in some scenarios
  2. Flash prompt question for copying links in external members
  3. Chart rendering problem when the sidebar is collapsed

2018-07-27 Update log

New Features

  1. The new version of the Report Center, download and enter other pages to see the data, will support more raw data export in the future
  2. Add special user categories to mark internal users, swipe users, and special users as special advertising channels for easy query and filtering.
  3. Wide-point support authorization mode
  4. Overview supports querying data by day, week and month
  5. The ad default query for ads with data to improve response speed
  6. Advertising adds hardware platform screening

Fixed

  1. LTV indicator optimization, more accurate description of indicator definition
  2. Fix some days to select a day, no problem showing hours
  3. Search gives priority to exact match results
  4. When using the filtering conditions (such as model and region) related to the device and account under the advertisement, the click information is not displayed to avoid misunderstanding.

2018-06-08 Update log

New Features

  1. You can select contrast date at Game List

  2. On paid pages, you can query data by product image description

  3. Official website update to new version

Fixed

  1. In some scenarios, total data shows garbled issues
  2. In some scenarios, chart rendering failed

2018-05-18 Update log

New Features

  1. User Value (LTV) supports viewing data on days 2, 4, 5, and 6
  2. TapDB started to support multiple languages. Currently it supports Simplified Chinese, Traditional Chinese , and English . It is about to support Korean and Japanese .
  3. Device Whitelist , if you need to test new subcontracting channels and whether new ads are turned on, you can whitelist the devices so that you can test different channels on one device.

image description

Fixed

  1. In the main dimension of cheats in ads, fixes the problem that suspect advertisements will count themselves

2018-05-04 Update log

New Features

  1. __Anti-cheating basic edition __, provides 3 kinds of basic anti-cheating rules: click on IP discrete cheating, activate IP discrete cheating, click on activation time to cheat.

  2. Supports two new advertising platforms: Momo, Baidu flow ocpc

  3. Press __payment channel __ to query income image description

  4. __Hidden channel __ , you can classify channels that are not commonly used, tested, or delivered incorrectly into hidden channel images image description

Fixed

1.New devices under overview do not show operational events


Advertising overview

Update log 2018-04-12

Advertising Overview can help you

  • Monitor whether today’s clicks, new additions, conversions are normal

Alt text

  • Learn about today's Top10 advertising platform

Alt text

  • Analysis of new user acquisition trends, spending and expense trends in the last 30 days

Alt text


Export segmented data

Update log 2018-01-11

Advertising monitoring supports the segmentation of exported advertising platforms, advertisements, and tags. After exporting, it is convenient to view the daily data of each advertisement.

Alt text


Hour active, weekly active, and monthly active

Update log 2017-12-15
  1. Now you can check the activity of different date granularity:
  • Active hour(HAU):Date select a day
  • Active daily(DAU):Date selected for a certain period of time
  • Natural Weekly Active(WAU):Switch to Weekly Active under Active Pages
  • Natural monthly Active(MAU):Switch to "monthly active" under the active page

Among them, weekly active and monthly active can subdivide different subcontracting channels to view the active channel details.

Alt text

  1. Add monthly active curve (MAU) in overview Alt text

Select time zone

Update log 2017-12-06

When creating a project, you can choose a different time zone to facilitate the analysis of the game issued by different regions.

Alt text


Display currency

Update log 2017-10-13

You can now view income data by different currency types.

Alt text


Data output

Update log 2017-07-20

Used in the tool, you can export the specific information of new users according to the advertising platform or advertising labels, such as adding accounts, IDFA, etc.

Alt text


Operation log

Update log 2017-07-13

You can view the operation log in the enterprise settings. Currently, three log types are available: project, permission, and advertisement. This helps you to understand the status of the project, change of personnel and authority, and advertisement delivery.

Alt text


Real-time online

Update log 2017-07-12

"Real-time online" function can help you conduct real-time online analysis, real-time current data dynamics through minute-level online volume. You can use [Tools - Extensions] or [Online Analysis] was opened and used.

Alt text


180/360 Day LTV

Update log 2017-07-07

180/360 day LTV increase under operations and advertising

  • Viewable in Pay-User Value in Operation Statistics
  • Add and view in custom columns in ad monitoring

Comparison date

Updated date 2017-06-02

Compare the dates, add the function of comparison date in the operation and advertisement module, and compare the data in different time periods. You can view the details of the comparison data in the graph and the table.

Alt text


It is now possible to nail down the usual day of comparison

Updated date 2017-05-25

When selecting a comparison date in the game overview, a new function has been added to record the date of your most recent 5 selections. You can pin in the dates that are commonly used and give them a special name. The date of the pinning will always be saved. For your next use.

Alt text


Name the channel

Updated date 2017-04-16

The name of the subcontracting channel can be remarked and can be used in the toolbar

Alt text


Doubtful new

Updated date 2017-04-16

The ad page adds doubts to new features, marking multiple ads that match new devices

Test device White List

When you need to use old equipment to test whether the subcontracting channel or advertisement is turned on, you can use the "Test device White List" function to accomplish this task.

一、Make sure your game has access to the latest SDK

The white list function requires access to the latest TapDB SDK. The specific version number is as follows:

iOS:v1.9.2

Android:v1.9.2

Cocos2d-x:v1.3.2

Unity 3D:v1.4.2

Download the SDK


二、Add test device

You can add test devices using two methods: scan QR Code and add manually

Method 1: scan QR Code to add

1.Download the TapDB App

Picture description

2.Open App

Not logged in: Click "!" in the upper left corner of the login screen to enter the add page

Logged in: Click "Settings" - "Test Device" in the upper left corner to enter the Add page

Picture description

3.Click "Add device" to scan QR Code in "Enterprise Settings" - "Test device" - "Add Device" on the Web

Picture description


Method 2: manually add

  1. Click “Enterprise Settings” - “Test device” - “+ Add device” in the menu in the upper right corner on the Web
    1. Select "Custom"
    2. Select the OS

Picture description

4.iOS:Fill in IDFA

The method of getting IDFA

  1. Download the TapDB app, click the test device, and get IDFA

5.Android is filled with Android ID or Google ID

The method of getting Android ID or Google ID

  1. Download the TapDB app, click the test device, and get the Android ID and Google ID
  2. Get Android ID:Open the phone dialing key and enter *#*#8255#*#*
  3. Get Google Advertising ID : https://support.google.com/googleplay/android-developer/answer/6048248?hl=en

Notes:

  1. Each enterprise supports adding 30 devices.
  2. It is not recommended to add emulator equipment. After adding the emulator of some brands, all devices using the simulator will be added to the white list.
  3. After the device is added to the white list, it will be effective for all items under the enterprise.
  4. After the device is removed from the white list, subsequent data will be transmitted on the first activated device number.

If you need help, please contact our technical supporter. QQ: 3171097571 Mail: support@tapdb.com

1 Introduction

1.1. Application

TapDB provides a set of SDKs that game developers can integrate into games. The system collects player data, analyzes them, and finally forms data reports to help game developers analyze player behavior and optimize games.

The current SDK is applicable to Android 2.2 and above systems.

1.2. Glossary

NounMeaning
PlayersFor a player account, a unique identifier is required. The player is the basic unit of statistics of the statistical system
EquipmentEquipment with corresponding games installed
PayingPlayers use real money in exchange for virtual currency or game props
Subcontracting channelsIdentify the source of the game installation package channels, need to be set in the code

2. Access method

2.1. Apply for an Application

Register a game in the TapDB console to get the game's corresponding APP ID. This is a 16-bit string. iOS and Android can share an APP ID.

2.2. Importing SDKs into a Project

Download the latest SDK on the TapDB website, which contains a library file libTyrantdbGameTracker.jar, and add the library file to the project's reference library.

2.3. Add Android Support Library

To add Android v4 support library to the project, the version of Android v4 support library must not be lower than 23.0.0, otherwise it may cause flashback.

If you use a gradle-dependent v4 support library with a version higher than 24.2.0, you can install the support-compat module only, see the documentation: https://developer.android.com/topic/libraries/support-library/setup.html , Https://developer.android.com/topic/libraries/support-library/features.html.

If you are inconvenient to use gradle for automated dependency installation, and you have not used the v4 support library before, you can use the jar file for the support-compat module provided here, https://static.tapdb.net/web/res/file/upload /2017/0926/android-support-v4.jar.

2.4. Add Required Permissions

You need to add the following permissions to AndroidManifest.xml in your project. When the targetSdkVersion configured in the AndroidManifest.xml is greater than or equal to 23, and the requestPermission is set to true in the initialization function, and the device runs on Android 6 or later, the TapDB SDK will prompt the user to perform optional permission authorization.

PermissionMust beUse
android.permission.INTERNETMandatoryUse network permissions
android.permission.ACCESS_NETWORK_STATERequiredGet phone network connection status
android.permission.WRITE_EXTERNAL_STORAGEOptionalUse SD card to assist storage device identification and other information, if you do not have this permission, some devices can not do a good device tracking

2.5. Calling Statistics Interface

In the code that needs to call the statistics interface, introduce the class com.xindong.tyrantdb.TyrantdbGameTracker and call the statistics interface according to the following interfaces.

3. Interface description

The TyrantdbGameTracker class is included in libTyrantdbGameTracker.jar, and the TGTUserType/TGTUserSex two enumeration types are also defined in the TyrantdbGameTracker class. TyrantdbGameTracker contains static methods that can be called directly with the class name. TGTUserType represents the player type and TGTUserSex represents the player's gender.

3.1. Initialization

To initialize the statistics system SDK, calling this interface is a prerequisite for using other interfaces and needs to be called as soon as possible. It is generally recommended to call InMainCreate's OnCreate.

Public static void init(Activity activity, String appId, String channel, String version, boolean requestPermission)
FieldCan be emptyDescription
ActivityNoThe current application's Activity object, usually passed into the MainActivity object
appIdNoAPP ID when registering for the game
Channelyessubcontracting channel, 1.2.
Versionyesgame version, when empty, automatically get the version of the game installer (versionName in AndroidManifest.xml)
requestPermissionNoWhether the above optional permissions are requested by the TapDB SDK. When the targetSdkVersion configured in the AndroidManifest.xml is greater than or equal to 23, and the parameter is true, and the device runs on Android 6 or later, the TapDB SDK will actively apply for the above-mentioned optional permissions stated in the APP.

3.2. Handling User Authorization Callbacks

Implement the android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback interface for the main activity, implement the onRequestPermissionsResult method, and call the onRequestPermissionsResult method of TapDB directly in the method and pass the received parameters. If the IDE reports an error, you can use @SuppressLint ("Override") ignores errors.

If you have implemented this method, add the call to TapDB's onRequestPermissionsResult method at the end of the method and pass the received parameter.

Note that the activity implementing the OnRequestPermissionsResultCallback interface must be the same as the activity passed to the TapDB init method.

This must be done when the targetSdkVersion defined in AndroidManifest.xml is greater than or equal to 23, and the requestPermission is set to true in the initialization function. It is recommended that no matter what the scene is added, prevent it from being forgotten when changed later.

// Note that the android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback interface must be implemented for the current class, rather than simply adding a method
@Override
Public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    TyrantdbGameTracker.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

3.3. Tracking the start and stop of the game

Track player game times and game durations. You need to add the corresponding call to onResume and onStop of each Activity in the game. If multiple Activities inherit the same parent class, you only need to add the call in the parent class. For example, the onResume method directly adds TyrantdbGameTracker.onResume(this) to the end of the Activity's onResume method.

Public static void onResume(final Activity activity)
Public static void onStop(final Activity activity)
FieldCan be emptyDescription
ActivityNoCurrent Activity object, usually passed this

3.4. Record a player

Record a player (note the platform user, not the game character!!!), which is called when the player logs in. If it is a demo user, the userId is generated by the game itself, but it needs to be guaranteed uniqueness.

Public static void setUser(String userId, TGTUserType userType, TGTUserSex userSex, int userAge, String userName)
FieldCan be emptyDescription
userIdNoPlayer ID (note that the platform user ID, not the game character ID!!!), different players must be unique, different user platforms may have the same user ID, need to find a way to distinguish
userTypeNoType of player, see detailed definition of type
userSexNoPlayer Sex, see type definition
userAgeNoAge of the player, unable to know player age directly passing 0
userNameyesplayer name

3.5. Player Level

Set the player level, which is called when the player logs in or when they upgrade.

Public static void setLevel(int level)
FieldCan be emptyDescription
Levelnoplayer level

3.6. Player Zone

Set player zone clothing, called when the player logs in or when changing zone clothing.

Public static void setServer(String server)
FieldCan be emptyDescription
ServerNoPlayer server

3.7. Initiate recharge request

(Recommended to use server-side recharge statistics interface)

Invoked when the player initiates a recharge request.

Reminder: Because of client-side behavior, it is inevitable that speculators will try to crack the recharge. If you do not pass the server verification, the data will be inaccurate. It is strongly recommended that you use the server interface to perform the recharge data recall. (4.1. Recharge statistics Interface)

Public static void onChargeRequest(String orderId, String product, long amount, String currencyType, long virtualCurrencyAmount, String payment)
FieldCan be emptyDescription
orderIdNoOrder ID
Productyesproduct name
AmountNoRecharge amount (in cents, whichever multi-currency needs to be multiplied by 100)
currencyTypeYesCurrency Type, Reference: RMB CNY, USD USD; EUR EUR
virtualCurrencyAmountNoRecharged virtual currency
PaymentYesPayment methods, such as: Alipay

3.8. Successfully recharged

Called when the recharge is successful and needs to be called in pairs with the recharge request

Public static void onChargeSuccess(String orderId)
FieldCan be emptyDescription
orderIdNoOrder ID, corresponding to the ID passed in the previous recharge request

3.9. Failed to recharge

Called when the recharge fails, needs to be called in pairs with the recharge request

Public static void onChargeFail(String orderId, String reason)
FieldCan be emptyDescription
orderIdNoOrder ID, corresponding to the ID passed in the previous recharge request
Reasonyesreason for failure

3.10. Only successful recharge

When the client cannot track the initiation of the recharge request and can only trace the event that the recharging is successful, this interface is called to record the recharge information.

Public static void onChargeOnlySuccess(String orderId, String product, long amount, String currencyType, long virtualCurrencyAmount, String payment)
FieldCan be emptyDescription
orderIdyesorder ID
Productyesproduct name
AmountNoRecharge amount (in cents, whichever multi-currency needs to be multiplied by 100)
currencyTypeYesCurrency Type, Reference: RMB CNY, USD USD; EUR EUR
virtualCurrencyAmountNoRecharged virtual currency
PaymentYesPayment methods, such as: Alipay

4. Server statistics interface

4.1. Recharge statistics interface

Because the client access recharge statistics may be inaccurate, the server recharging statistics method is provided here. It is necessary to ignore the related recharge statistics interface in the SDK.

Interface: https://e.tapdb.net/event
Content (note that we need to deal with it later):
{
     "module": "GameAnalysis", //fixed
     "ip": "8.8.8.8", // recharge user's IP, optional
     "name": "charge", //fixed
     "index": "APPID", //APPID Note Replaced by TapDB's appid
     "identify": "user_id", //user_id, must be the same as the user_id passed on the client's setUser interface, and the user has already passed statistics through the SDK interface.
     "properties": {
         "order_id": "100000", //order_id, optional, If you pass this parameter, you need to ensure that the order_id is unique. Repeated orders are not included in the statistics.
         "amount": 100, //the amount of recharge (units, whichever is multiplied by 100) must pass
         "virtual_currency_amount": 100, //Number of tokens to be given, must pass, can be 0
         "currency_type": "CNY", // currency type, optional, not passed or not the correct currency type, uniformly processed into RMB
         "product": "item1", // recharge package name, optional
         "payment": "alipay" // recharging route, optional
    }
}

If the appid of the game is abcd1234, after constructing the json string, it is necessary to remove the space and newline character, then perform another urlencode, and send the result as post data.
Replace line breaks and spaces first and become:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount": 100, "virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
Then urlencode, becomes the following form, some versions of urlencode may encode ':' and ',' without affecting actual use.
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B% 22order_id%22: %22100000%22, %22amount%22:100, %22virtual_currency_amount%22:100, %22currency_type%22: %22CNY%22, %22product%22: %22item1%22, %22payment%22: %22alipay %22%7D%7D

Currency Type Format Reference Rate Table

Successfully judged that the returned HTTP Code is 200 and thinks that the message was sent successfully; otherwise, it thinks it failed.

4.2. Online Data Statistics Interface

Because the SDK cannot perform accurate online data statistics, the server provides an online data statistics interface. The game server can count the number of online users every 5 minutes, send it to TapDB through the interface, and TapDB to collect and display the data.

Interface: https://se.tapdb.net/tapdb/online
Method: POST
Format: json
Must have header information: Content-Type: application/json

Request content:

Parameter NameParameter TypeParameter Description
AppidstringTapDB appid
OnlinesarrayOnline data (up to 100)

The structure of the lines array is

Parameter NameParameter TypeParameter Description
ServerstringServer, TapDB accepts data only once every 5 minutes for the same server
OnlineintPeople online
TimestamplongThe timestamp of the current statistic (seconds). TapDB will align the data by natural 5 minutes.

Example:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

Successfully judged that the returned HTTP Code is 200 and thinks that the message was sent successfully; otherwise, it thinks it failed.

1 Introduction

1.1. Application

The SDK that encapsulates TapDB is suitable for games developed by Cocos2d-x. It also supports iOS and Android platforms.

1.2. Glossary

NounMeaning
PlayersFor a player account, a unique identifier is required. The player is the basic unit of statistics of the statistical system
EquipmentEquipment with corresponding games installed
PayingPlayers use real money in exchange for virtual currency or game props
Subcontracting channelsIdentify the source of the game installation package channels, need to be set in the code

2. Access method

2.1. Apply for an Application

Register a game in the TapDB console to get the game's corresponding APP ID. This is a 16-bit string. iOS and Android can share an APP ID.

2.2. Importing SDKs into a Project

Download the latest SDK on the TapDB website, which contains a TapDB_sdk.zip file. Extract the three folders. The include folder contains the header files. The iOS and Android folders are the implementation code and library files of the corresponding platform. In addition, add a reference to TapDB.cpp inside Android.mk.

2.3. Add Android Support Library

To add Android v4 support library to the project, the version of Android v4 support library must not be lower than 23.0.0, otherwise it may cause flashback.

If you use a gradle-dependent v4 support library with a version higher than 24.2.0, you can install the support-compat module only, see the documentation: https://developer.android.com/topic/libraries/support-library/setup.html , Https://developer.android.com/topic/libraries/support-library/features.html.

If you are inconvenient to use gradle for automated dependency installation, and you have not used the v4 support library before, you can use the jar file for the support-compat module provided here, https://static.tapdb.net/web/res/file/upload /2017/0926/android-support-v4.jar.

2.4.Android Add Required Permissions

Need to add the following permissions to AndroidManifest.xml in the project

PermissionNecessityUse
android.permission.INTERNETMandatoryUse network permissions
android.permission.ACCESS_NETWORK_STATERequiredGet phone network connection status
android.permission.WRITE_EXTERNAL_STORAGEOptionalUse SD card to assist storage device identification and other information, if you do not have this permission, some devices can not do a good device tracking

2.5.iOS Introduces Dependency Framework

Need to introduce the following dependent frameworks or libraries for Xcode projects

Framework or LibraryUses
CoreTelephony.frameworkUsed to obtain carrier ID
AdSupport.frameworkused to get the device's advertising ID, tracking device
Security.frameworkUsed for better persistent storage

2.6. Invoking the Statistics Interface

In the code that needs to call the statistics interface, introduce TapDB.h, and follow the interface description to invoke the statistics interface.

3. Interface description

TapDB.h contains the class TapDB and also defines two enum types TGTUserType/TGTUserSex. TapDB contains static methods that can be called directly with the class name. TGTUserType represents the player type and TGTUserSex represents the player's gender.

3.1. Initialization

To initialize the statistics system SDK, calling this interface is a prerequisite for using other interfaces and needs to be called as soon as possible. The init method initializes the SDK, and no other method of the SDK can be called before this.

Android needs to import libTyrantdbGameTracker.jar and call TyrantdbGameTracker.init(Activity activity, String appId, String channelId, String version, bool requestPermission) in the main activity's onCreate() , with the last parameter fixedly passing false.

public static void onStart(string appId, string channel, string version)
FieldCan be emptyDescription
appIdNoAPP ID when registering for the game
Channelyessubcontracting channel, 1.2.
Versionyesgame version, when empty, automatically get the version of the game installation package

3.2.Track game start and stop (applies to Android only)

Track player game times and game durations. You need to add a corresponding call to onResume and onStop for each Activity in the game. For example: call TyrantdbGameTracker.onStop (this); in MainActivity.

public static void onResume(Context ctx)
public static void onStop(Context ctx)

3.3. Record a player

Record a player (note the platform user, not the game character!!!), which is called when the player logs in. If it is a demo user, the userId is generated by the game itself, but it needs to be guaranteed uniqueness.

public static void setUser(const char *userId, TGTUserType userType, TGTUserSex userSex,
 int userAge, const char *userName)
FieldCan be emptyDescription
userIdNoPlayer ID (note that the platform user ID, not the game character ID!!!), different players must be unique, different user platforms may have the same user ID, need to find a way to distinguish
userTypeNoType of player, see detailed definition of type
userSexNoPlayer Sex, see type definition
userAgeNoAge of the player, unable to know player age directly passing 0
userNameyesplayer name

3.4.Player level

Set the player level, which is called when the player logs in or when they upgrade.

public static void setLevel(int level)
FieldCan be emptyDescription
Levelnoplayer level

3.5. Player Zone

Set player zone clothing, called when the player logs in or when changing zone clothing.

public static void setServer(const char *server)
FieldCan be emptyDescription
ServerNoPlayer server

3.6.Initiate recharge request

(It is recommended to use the server-side recharge statistics interface)

Invoked when the player initiates a recharge request.

Reminder: Because of client-side behavior, it is inevitable that speculators will try to crack the recharge. If you do not pass the server verification, the data will be inaccurate. It is strongly recommended that you use the server interface to perform the recharge data recall. (4.1.Recharge statistics interface)

public static void onChargeRequest(const char *orderId, const char *product,
 long amount, const char * currencyType, long virtualCurrencyAmount, const char *payment)
FieldCan be emptyDescription
orderIdNoOrder ID
Productyesproduct name
AmountNoRecharge amount (in cents, whichever multi-currency needs to be multiplied by 100)
currencyTypeYesCurrency Type, Reference: RMB CNY, USD USD; EUR EUR
virtualCurrencyAmountNoRecharged virtual currency
PaymentYesPayment methods, such as: Alipay

3.7. Successfully recharged

Called when the recharge is successful and needs to be called in pairs with the recharge request

public static void onChargeSuccess(const char *orderId)
FieldCan be emptyDescription
orderIdNoOrder ID, corresponding to the ID passed in the previous recharge request

3.8. Recharging failed

Called when the recharge fails, needs to be called in pairs with the recharge request

public static void onChargeFail(const char *orderId, const char *reason)
FieldCan be emptyDescription
orderIdNoOrder ID, corresponding to the ID passed in the previous recharge request
Reasonyesreason for failure

3.9. Successfully recharged

When the client cannot track the initiation of the recharge request and can only trace the event that the recharging is successful, this interface is called to record the recharge information.

public static void onChargeOnlySuccess(const char *orderId, const char *product, 
long amount, const char *currencyType, long virtualCurrencyAmount, const char *payment)
FieldCan be emptyDescription
orderIdyesorder ID
Productyesproduct name
AmountNoRecharge amount (in cents, whichever multi-currency needs to be multiplied by 100)
currencyTypeYesCurrency Type, Reference: RMB CNY, USD USD; EUR EUR
virtualCurrencyAmountNoRecharged virtual currency
PaymentYesPayment methods, such as: Alipay

4. Server statistics interface

4.1. Recharge statistics interface

Because the client access recharge statistics may be inaccurate, the server recharging statistics method is provided here. It is necessary to ignore the related recharge statistics interface in the SDK.

Interface: https://e.tapdb.net/event
Content (note that we need to deal with it later):
{
     "module": "GameAnalysis", //fixed
     "ip": "8.8.8.8", // recharge user's IP, optional
     "name": "charge", //fixed
     "index": "APPID", //APPID Note Replaced by TapDB's appid
     "identify": "user_id", //user_id, must be the same as the user_id passed on the client's setUser interface, and the user has already passed statistics through the SDK interface.
     "properties": {
         "order_id": "100000", //order_id, optional,If you pass this parameter, you need to ensure that the order_id is unique. Repeated orders are not included in the statistics.
         "amount": 100, //the amount of recharge (units, whichever is multiplied by 100) must pass
         "virtual_currency_amount": 100, //Number of tokens to be given, must pass, can be 0
         "currency_type": "CNY", // currency type, optional, not passed or not the correct currency type, uniformly processed into RMB
         "product": "item1", // recharge package name, optional
         "payment": "alipay" // recharging route, optional
     }
}

If the appid of the game is abcd1234, after constructing the json string, it is necessary to remove the space and newline character, then perform another urlencode, and send the result as post data.
Replace line breaks and spaces first and become:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount": 100, "virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
Then urlencode, becomes the following form, some versions of urlencode may encode ':' and ',' without affecting actual use.
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

Currency Type Format Reference Rate Table

Successfully judged that the returned HTTP Code is 200 and thinks that the message was sent successfully; otherwise, it thinks it failed.

4.2. Online Data Statistics Interface

Because the SDK cannot perform accurate online data statistics, the server provides an online data statistics interface. The game server can count the number of online users every 5 minutes, send it to TapDB through the interface, and TapDB to collect and display the data.

Interface: https://se.tapdb.net/tapdb/online
Method: POST
Format: json
Http header:Content-Type: application/json

Request content:

Parameter NameParameter TypeParameter Description
AppidstringTapDB appid
OnlinesarrayOnline data (up to 100)

The structure of the lines array is

Parameter NameParameter TypeParameter Description
ServerstringServer, TapDB accepts data only once every 5 minutes for the same server
OnlineintPeople online
TimestamplongThe timestamp of the current statistic (seconds). TapDB will align the data by natural 5 minutes.
{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

Successfully judged that the returned HTTP Code is 200 and thinks that the message was sent successfully; otherwise, it thinks it failed.

1.Introduction

1.1.Scope of application

TapDB provides a set of SDKs that game developers can integrate into games. The system collects player data, analyzes them, and finally forms data reports to help game developers analyze player behavior and optimize games.

The current SDK is applicable to iOS 5.0 and above systems and supports the armv7/armv7s/arm64 architecture.

1.2.Glossary

Wordsmeaning
playerCorresponding to a player account requires a unique identifier. The player is the basic unit of statistics of the statistical system
deviceThe device with the corresponding game is installed
paymentPlayers use real money in exchange for game tokens or game props
SubcontractingIdentifies the game installation package channel source and needs to be set in the code

2.Access method

2.1.Apply for application

Register a game in the TapDB console to get the game's corresponding APP ID. This is a 16-bit string. iOS and Android can share an APP ID.

2.2.Import SDK to Xcode Project

Download the latest SDK on the TapDB website, which contains a header file TyrantdbGameTracker.h and a static link library file libTyrantdbGameTracker.a. Import the two files into the Xcode project and make sure that all Targets that need the SDK are linked to the static library file.

2.3.Introducing a dependency framework

Need to introduce the following dependent frameworks or libraries for Xcode projects

Framework or libraryuse
CoreTelephony.frameworkUsed to obtain carrier ID
AdSupport.frameworkUsed to obtain equipment advertising identification, tracking equipment
Security.frameworkUsed for better persistent storage

2.4.Call statistics interface

The header file TyrantdbGameTracker.h is introduced in the code that needs to call the statistics interface, and the call statistics interface is introduced according to the following interfaces.

3.Interface Description

A TyrantdbGameTracker class and TGTUserType/TGTUserSex two enumeration types are defined in the header file. TyrantdbGameTracker contains static methods that can be called directly with the class name. TGTUserType represents the player type and TGTUserSex represents the player's gender.

3.1.initialization

To initialize the statistics system SDK, calling this interface is a prerequisite for using other interfaces and needs to be called as soon as possible. It is generally recommended to call AppDelegate's application:didFinishLaunchingWithOptions

+ (void)onStart:(NSString *)appId channel:(NSString *)channel version:(NSString *)version;
FieldsCan be emptyInstructions
appIdnoApp ID obtained when registering the game App ID obtained when registering the game
channelyesSubcontracting channels, introduced in 1.2.
versionyesGame version, when empty, automatically obtains the version of the game installation package (Version in Xcode configuration)

3.2.Record a player

Record a player (note the platform user, not the game character!!!), which is called when the player logs in. If it is a demo user, the userId is generated by the game itself, but it needs to be guaranteed uniqueness.

+ (void)setUser:(NSString *)userId userType:(TGTUserType)userType userSex:(TGTUserSex)userSex userAge:(NSInteger)userAge userName:(NSString *)userName;
FieldsCan be emptyInstructions
userIdnoPlayer ID (pay attention to the platform user ID, not the game character ID!!!), different players must be unique, different user platforms may have the same user ID, need to find a way to distinguish
userTypenoPlayer type, see detailed definition of type
userSexnoPlayer gender, see type definition
userAgenoPlayer age, unable to know player age directly pass 0
userNamenoPlayer name

3.3.Player level

Set the player level, which is called when the player logs in or when they upgrade.

+ (void)setLevel:(NSInteger)level;
FieldsCan be emptyInstructions
levelnoPlayer level

3.4.Player area service

Set player zone clothing, called when the player logs in or when changing zone clothing.

+ (void)setServer:(NSString *)server;
FieldsCan be emptyInstructions
servernoPlayer server

3.5.Initiate recharge request

(It is recommended to use the server-side recharge statistics interface)

Invoked when the player initiates a recharge request.

remind:Due to the client's behavior, it is inevitable that speculators will try to crack the recharge. If you do not pass the server verification, the data will be inaccurate. It is strongly recommended that you use the server interface to perform the recharge data recall. (4.1. Recharge statistics Interface)

+ (void)onChargeRequest:(NSString *)orderId product:(NSString *)product amount:(NSInteger)amount currencyType:(NSString *)currencyType virtualCurrencyAmount:(NSInteger)virtualCurrencyAmount payment:(NSString *)payment;
FieldsCan be emptyInstructions
orderIdnoorder ID
productyesproduct name
amountnoThe amount of recharge (units, whichever number of currencies you need to multiply by 100)
currencyTypeyesCurrency Type, Reference: RMB CNY, USD USD; EUR EUR
virtualCurrencyAmountnoRecharged virtual currency
paymentyesPayment methods, such as: Alipay

3.6.Recharge success

Called when the recharge is successful and needs to be called in pairs with the recharge request

+ (void)onChargeSuccess:(NSString *)orderId;
FieldsCan be emptyInstructions
orderIdnoOrder ID, corresponding to the ID passed by the previously called recharge request

3.7.Recharge failed

Called when the recharge fails, needs to be called in pairs with the recharge request

+ (void)onChargeFail:(NSString *)orderId reason:(NSString *)reason;
FieldsCan be emptyInstructions
orderIdnoOrder ID, corresponding to the ID passed by the previously called recharge request
reasonyesReason for failure

3.8.Only recharge successful

When the client cannot track the initiation of the recharge request and can only trace the event that the recharging is successful, this interface is called to record the recharge information.

+ (void)onChargeOnlySuccess:(NSString *)orderId product:(NSString *)product amount:(NSInteger)amount currencyType:(NSString *)currencyType virtualCurrencyAmount:(NSInteger)virtualCurrencyAmount payment:(NSString *)payment;
FieldCan be emptyDescription
orderIdyesorder ID
productyesproduct name
amountnoThe amount of recharge (units, whichever number of currencies you need to multiply by 100)
currencyTypeyesCurrency Type, Reference: RMB CNY, USD USD; EUR EUR
virtualCurrencyAmountnoRecharged virtual currency
paymentyesPayment methods, such as: Alipay

4.Server Statistics Interface

4.1.Recharge statistics interface

Because the client access recharge statistics may be inaccurate, the server recharging statistics method is provided here. It is necessary to ignore the related recharge statistics interface in the SDK.

Interface: https://e.tapdb.net/event
Content (note that we need to deal with it later):
{
    "module": "GameAnalysis", //fixed
    "ip": "8.8.8.8", //Recharge user's IP, optional
    "name": "charge", //fixed
    "index": "APPID", //APPID Note Replaced by TapDB's appid
   "identify": "user_id", //user_id, must be the same as the user_id passed on the client's setUser interface, and the user has already passed statistics through the SDK interface.
    "properties": {
        "order_id": "100000", //order_id,optional,If you pass this parameter, you need to ensure that the order_id is unique. Repeated orders are not included in the statistics.
        "amount": 100, //The amount of recharge (units, ie, whatever the currency, you need to multiply by 100), must transfer
        "virtual_currency_amount": 100, //Get the number of virtual currency, must pass, can be 0
        "currency_type": "CNY", //Currency type, optional, not transmitted or not the correct currency type, uniformly processed into RMB
        "product": "item1", //Recharge package name, optional
        "payment": "alipay" //Recharging method, optional
    }
}

If the appid of the game is abcd1234, after constructing the json string, it is necessary to remove the space and newline character, then perform another urlencode, and send the result as post data.
Replace line breaks and spaces first and become:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount":100,"virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
Then urlencode, becomes the following form, some versions of urlencode may encode ':' and ',' without affecting actual use.
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

Currency Type Format Reference Rate Table

Successfully judged that the returned HTTP Code is 200 and thinks that the message was sent successfully; otherwise, it thinks it failed.

4.2.Online data statistics interface

Because the SDK cannot perform accurate online data statistics, the server provides an online data statistics interface. The game server can count the number of online users every 5 minutes, send it to TapDB through the interface, and TapDB to collect and display the data.

interface:https://se.tapdb.net/tapdb/online
method:POST
format:json
Http header:Content-Type: application/json

Request content:

Parameter NameParameter TypeParameter Description
appidstringAppid in TapDB
onlinesarrayMultiple online data (up to 100)

The structure of the lines array is

Parameter NameParameter TypeParameter Description
serverstringServer, TapDB receives data only once every 5 minutes for the same server
onlineintonline users
timestamplongTimestamp of current statistics (seconds),TapDB aligns data naturally for 5 minutes

Example:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

Successfully judged that the returned HTTP Code is 200 and thinks that the message was sent successfully; otherwise, it thinks it failed.

Access documents

Docking SDK developers please read carefully

  1. Currently supports iOS, Android, U3D, cocos SDK and documentation for developers to choose

  2. The passed data cannot be modified. Please correctly transmit relevant data such as channel, player, and income for subsequent data analysis.

  3. Recharge and player online data to provide server-side delivery methods to make data more accurate

  4. Any problems encountered during access, you can contact technical support QQ: 3485772949

SDK文档

1.Introduction

1.1.Scope of application

TapDB provides a set of SDKs that game developers can integrate into games. The system collects player data, analyzes them, and finally forms data reports to help game developers analyze player behavior and optimize games.

Games for Unity development, Android support 2.2 and above, iOS support 5.0 and above.

1.2.Glossary

WordsMeaning
PlayersCorresponding to a player account requires a unique identifier. The player is the basic unit of statistics of the statistical system
DeviceThe device with the corresponding game is installed
PaymentPlayers use real money in exchange for game tokens or game props
SubcontractingIdentifies the game installation package channel source and needs to be set in the code

2.Access method

2.1.Apply for application

Register a game in the TapDB console to get the game's corresponding APP ID. This is a 16-bit string. iOS and Android can share an APP ID.

2.2.Import the SDK into your project

Download the latest SDK on TapDB website, which contains a TapDB.unitypackage file. In the Unity3D compiler, select Assets --> Import Package --> Custom Package. Find the TapDB.unitypackage file and click "Open button" to import successfully. Where demo.cs is just sample code, not the code needed by the SDK.

2.3.Add Android support library

To add Android v4 support library to the project, the version of Android v4 support library must not be lower than 23.0.0, otherwise it may cause flashback.

If you use a gradle-dependent v4 support library with a version higher than 24.2.0, you can install only the support-compat module. Read the documentation: https://developer.android.com/topic/libraries/support-library/setup.htmlhttps://developer.android.com/topic/libraries/support-library/features.html

If you are inconvenient to use gradle for automated dependency installation, and you have not used the v4 support library before, you can use the jar file of the support-compat module provided here. https://static.tapdb.net/web/res/file/upload/2017/0926/android-support-v4.jar

2.4.Android add required permissions

You need to add the following permissions to AndroidManifest.xml in your project. When the targetSdkVersion configured in the AndroidManifest.xml is greater than or equal to 23, and the requestPermission is set to true in the initialization function, and the device runs on Android 6 or later, the TapDB SDK will prompt the user to perform optional permission authorization.

AuthorityNecessityUse
android.permission.INTERNETRequiredUse network permissions
android.permission.ACCESS_NETWORK_STATERequiredGet phone network connection status
android.permission.WRITE_EXTERNAL_STORAGEOptionalUse SD card to assist storage device identification and other information. If you do not have this permission, some devices cannot perform good device tracking.

2.5.iOS introduces a dependency framework

Need to import the following dependent frameworks or libraries for the Xcode project exported by iOS

Framework or libraryUse
CoreTelephony.frameworkUsed to obtain carrier ID
AdSupport.frameworkUsed to obtain equipment advertising identification, tracking equipment
Security.frameworkUsed for better persistent storage

2.6.Call statistics interface

In the code that needs to call the statistics interface, class TapDB is introduced, and the calling interface is introduced according to the following interfaces.

3.Interface Description

The TapDB class defines two enumerated types of TGTUserType/TGTUserSex. TapDB contains static methods that can be called directly with the class name. TGTUserType represents the player type and TGTUserSex represents the player's gender.

3.1.Initialization

To initialize the statistics system SDK, calling this interface is a prerequisite for using other interfaces and needs to be called as soon as possible. It is generally recommended to call Start() in Unity.

public static void onStart(string appId, string channel, string gameVersion, bool requestPermission)
FieldsCan be emptyInstructions
appIdnoApp ID obtained when registering for the game
channelyesSubcontracting channels, introduced in 1.2.
gameVersionyesGame version, when empty, automatically obtains the version of the game installation package (Android is the versionName in AndroidManifest.xml, iOS is the Version in Xcode configuration)
requestPermissionnoWhether the above optional permissions are requested by the TapDB SDK on Android. When the targetSdkVersion configured in the AndroidManifest.xml is greater than or equal to 23, and the parameter is true, and the device runs on Android 6 or later, the TapDB SDK will actively apply for the above-mentioned optional permissions stated in the APP.

3.2.Android handles user authorization callbacks

Implement the android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback interface for the main activity, implement the onRequestPermissionsResult method, and call the onRequestPermissionsResult method of TapDB directly in the method and pass the received parameters. If the IDE reports an error, you can use @SuppressLint ("Override") ignores errors.

If you have implemented this method, add the calling code at the end of the method.

The main activity is generally a subclass that inherits from com.unity3d.player.UnityPlayerActivity and needs to be specified as the main activity in AndroidManifest.xml.

This must be done when the targetSdkVersion defined in AndroidManifest.xml is greater than or equal to 23, and the requestPermission is set to true in the initialization function. It is recommended that no matter what the scene is added, prevent it from being forgotten when changed later.

// Note that the android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback interface must be implemented for the current class, rather than simply adding a method
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    try {
        Class<?> clazz = Class.forName("com.xindong.tyrantdb.TyrantdbGameTracker");
        Method method = clazz.getMethod("onRequestPermissionsResult", int.class, String[].class, int[].class);
        method.invoke(null, requestCode, permissions, grantResults);
    } catch (ClassNotFoundException e) {
    } catch (NoSuchMethodException e) {
    } catch (IllegalAccessException e) {
    } catch (IllegalArgumentException e) {
    } catch (InvocationTargetException e) {
    }
}

Do not confuse com.xindong.tyrantdb.TyrantdbGameTracker when using obfuscated calls in the code.

3.3.Track game start and stop

Track player game times and game durations. It can be called by referring to the SDK demo.

public static void onResume()
public static void onStop()

3.4.Record a player

Record a player (note the platform user, not the game character!!!), which is called when the player logs in. If it is a demo user, the userId is generated by the game itself, but it needs to be guaranteed uniqueness.

public static void setUser(string userId, TGTUserType userType, TGTUserSex userSex, int userAge, string userName)
FieldsCan be emptyInstructions
userIdnoPlayer ID (pay attention to the platform user ID, not the game character ID!!!), different players must be unique, different user platforms may have the same user ID, need to find a way to distinguish
userTypenoPlayer type, see detailed definition of type
userSexnoPlayer gender, see type definition
userAgenoPlayer age, unable to know player age directly pass 0
userNameyesPlayer name

3.5.Player level

Set the player level, which is called when the player logs in or when they upgrade.

public static void setLevel(int level)
FieldsCan be emptyInstructions
levelnoPlayer level

3.6.Player area service

Set player zone clothing, called when the player logs in or when changing zone clothing.

public static void setServer(string server)
FieldsCan be emptyInstructions
servernoPlayer server

3.7.Initiate recharge request

(It is recommended to use the server-side recharge statistics interface)

Invoked when the player initiates a recharge request.

remind:Due to the client's behavior, it is inevitable that speculators will try to crack the recharge. If you do not pass the server verification, the data will be inaccurate. It is strongly recommended that you use the server interface to perform the recharge data recall. (4.1.Recharge statistics interface)

public static void onChargeRequest(string orderId, string product, Int32 amount, string currencyType, Int32 virtualCurrencyAmount, string payment)
FieldsCan be emptyInstructions
orderIdnoOrder ID
productyesproduct name
amountnoThe amount of recharge (units, whichever number of currencies you need to multiply by 100)
currencyTypeyesCurrency Type, Reference: RMB CNY, USD USD; EUR EUR
virtualCurrencyAmountnoRecharged virtual currency
paymentyesPayment methods, such as: Alipay

3.8.Recharge success

Called when the recharge is successful and needs to be called in pairs with the recharge request

public static void onChargeSuccess(string orderId)
FieldsCan be emptyInstructions
orderIdnoOrder ID, corresponding to the ID passed by the previously called recharge request

3.9.Recharge failed

Called when the recharge fails, needs to be called in pairs with the recharge request

public static void onChargeFail(string orderId, string reason)
FieldsCan be emptyInstructions
orderIdnoOrder ID, corresponding to the ID passed by the previously called recharge request
reasonyesReasons for failure

3.10.Only recharge successful

When the client cannot track the initiation of the recharge request and can only trace the event that the recharging is successful, this interface is called to record the recharge information.

public static void onChargeOnlySuccess(string orderId, string product, Int32 amount, string currencyType, Int32 virtualCurrencyAmount, string payment)
FieldsCan be emptyInstructions
orderIdyesOrder ID
productyesproduct name
amountnoThe amount of recharge (units, whichever number of currencies you need to multiply by 100)
currencyTypeyesCurrency Type, Reference: RMB CNY, USD USD; EUR EUR
virtualCurrencyAmountnoRecharged virtual currency
paymentyesPayment methods, such as: Alipay

4.Server Statistics Interface

4.1. Recharge statistics interface

Because the client access recharge statistics may be inaccurate, the server recharging statistics method is provided here. It is necessary to ignore the related recharge statistics interface in the SDK.

Interface: https://e.tapdb.net/event
Content (note that we need to deal with it later):
{
    "module": "GameAnalysis", //fixed
    "ip": "8.8.8.8", //Recharge user's IP, optional
    "name": "charge", //fixed
    "index": "APPID", //APPID Note Replaced by TapDB's appid
    "identify": "user_id", //User_id must be the same as the user_id passed in the client's setUser interface, and the user has already performed statistics through the SDK interface.
    "properties": {
        "order_id": "100000", //order_id,optional,If you pass this parameter, you need to ensure that the order_id is unique. Repeated orders are not included in the statistics.
        "amount": 100, //The amount of recharge (units, ie, whatever the currency, you need to multiply by 100), must pass
        "virtual_currency_amount": 100, //Get the number of virtual currency, must pass, can be 0
        "currency_type": "CNY", //Currency type, optional, not transmitted or not the correct currency type, uniformly processed into RMB
        "product": "item1", //Recharge package name, optional
        "payment": "alipay" //Recharging method, optional
    }
}

If the appid of the game is abcd1234, after constructing the json string, it is necessary to remove the space and newline character, then perform another urlencode, and send the result as post data.
Replace line breaks and spaces first and become:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount":100,"virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
Then urlencode, becomes the following form, some versions of urlencode may encode ':' and ',' without affecting actual use.
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

Currency Type Format Reference Rate Table

Successfully judged that the returned HTTP Code is 200 and thinks that the message was sent successfully; otherwise, it thinks it failed.

4.2.Online data statistics interface

Because the SDK cannot perform accurate online data statistics, the server provides an online data statistics interface. The game server can count the number of online users every 5 minutes, send it to TapDB through the interface, and TapDB to collect and display the data.

interface:https://se.tapdb.net/tapdb/online
method:POST
format:json
Http header:Content-Type: application/json

Request content:

parameter nameParameter TypeParameter Description
appidstringTapDB appid
onlinesarrayMultiple online data (up to 100)

The structure of the lines array is

parameter nameParameter TypeParameter Description
serverstringServer, TapDB receives data only once every 5 minutes for the same server
onlineintonline users
timestamplongTimestamp of the current statistics (seconds), TapDB will align the data according to the natural 5 minutes

Example:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

Successfully judged that the returned HTTP Code is 200 and thinks that the message was sent successfully; otherwise, it thinks it failed.

1.对接问题

Q:单机游戏的userId如何储存?

A:单机游戏的userId需要注意以下几点:

(1)iOS得自己生成一个ID存到证书空间,iOS有个存储空间,一个是应用,一个是证书(企业)。

(2)安卓尽量存到SD卡,用一个用户操作或者1分钟后调用setUser。

(3)随机生成一个唯一用户ID,并保存到本地,以后都用它。


Q:为什么SDK接入后没有新增数据?

A:请检查SDK初始化有没有调用成功,失败的话会有相应的失败日志,并确认初始化是最早调用的。


Q:服务端和客户端都需要传递充值数据么?

A:服务端和客户端只需要选择其中一种方式传递充值数据,同时使用数据会传递两份,收入就会翻倍。


Q:为什么服务端传递充值数据TapDB页面没有显示收入或者收入比实际要多?

A:首先服务端和客户端的接口只能用其中一个(都使用的话会纪录双份充值,并确保充值成功再发送充值数据),其次服务端”identify”: “user_id”里的user_id和文档“纪录一个玩家”中的setUser里的“userId”需要保持一致。


Q:为什么实时在线数据发送后TapDB显示没有数据?

A:没有显示数据可能有以下几种原因:

(1)检查文件格式,参数类型(返回400报错说明格式不对)

(2)注意时间戳单位(秒),并且只能发送近7日数据,太早的数据不会纪录保存

(3)注意:是否有必须头信息:Content-Type: application/json


Q:可以为空的参数可以不填么?

A:不可以,可以为空的地方参数填null。


Q:为什么填了channel在TapDB里找不到这个分包渠道?

A:必须要有一个新增数据TapDB才能接收到这个渠道,才能在这个页面里显示这个分包渠道。


2.常见问题

Q:如何查看各种维度下的数据?

A:在来源,在线,留存,付费四个页面里的表格中都有主维度的切换选项,每个维度下显示的数据都不同,可以根据不同情况来查看各个维度下的数据。


Q:什么是分包渠道?

A:分包渠道就是联运平台,也就是这个包即将上线的平台,在初始化的channel中传递该参数,比如说,这个包上架App Store,就传递App Store即可,后续可以只看该分包渠道的数据,方便筛选优质的联运平台。


Q:如何使用过滤条件?

A:过滤条件可以根据不同的选项,不同的范围来选择TapDB表格内展现的数据,方便区分各种类型的用户。可以添加多个过滤条件来精确筛选满足条件的数据,也可以保存设定好的过滤条件方便下次使用。


Q:为什么来源的收入比实际的收入要少?

A:来源只显示新增用户的付费收入情况,老用户的付费情况请在付费页面查看。


Q:为什么游戏的转化率很低?

A:转化率低可能有以下几种原因:

(1)技术人员确保SDK在用户登录的时候调用了setUser。

(2)运营人员注意是否有大量的新增设备,可能有作弊机器在刷新增。


3.广告相关问题

Q:如何创建广告计划?

A:进入TapDB,广告页面,点击广告管理,选择右上角的新增广告活动,选择广告平台,注意看下匹配方式,填写信息,生成投放链接。


Q:什么是IP匹配?

A:IP匹配是通过用户点击广告时的IP和打开游戏时的IP是否一致进行匹配的,适用所有广告。创建广告活动时如果没有发现对应平台可以创建自定义广告。


Q:什么是设备匹配?

A:设备匹配是TapDB和广告平台已经对接完成,广告平台将点击广告的数据返回TapDB,通过设备信息来匹配新增用户的,十分精准,但仅使用于和TapDB对接完成的广告平台。


Q:IP匹配和设备匹配怎么投放?

A:TapDB的广告匹配分为IP匹配和设备匹配:

IP匹配: 在新增广告活动时,选择广告平台,IP匹配的广告平台都有标注,且IP匹配的广告需要填写下载链接,生成链接后,直接将IP匹配生成的投放链接填入广告平台的落地页URL即可。

设备匹配: 设备匹配填写相应参数后可以直接生成回调链接,填入广告平台的第三方监控链接(名称可能不同)中即可,落地页URL填写游戏本身的下载地址。


Q:不能使用TapDB的链接投放广告时怎么办?

A:比如说游戏的域名是a.b.c,需要把a.b.c以CNAME的形式解析到l.tapdb.net,然后如果TapDB给出的连接是https://l.tapdb.net/xxxx,直接替换l.tapdb.net为a.b.c,https改为http,变成http://a.b.c/xxxx,使用该链接投递广告。


Q:为什么投放广告匹配到其他系统的玩家?

A:广告匹配到其他系统的玩家可能有以下原因:

(1)投放在web上,iOS和Android用户都会被匹配

(2)iOS的投放链接,Android用户(能看到该广告)可能会点击后主动去搜索该app下载,就会被匹配上,同理Android广告也可能被iOS用户匹配。

常见问题

这里将提供使用TapDB中遇到的问题的解决方案。

包含了对接问题、数据相关问题、广告相关问题以及其他可能遇见的问题。

TapDB无网络连接问题解决方案

如果你遇到了“无网络连接”的问题,可以按照下面的解决方案进行尝试。

问题原因

苹果在iOS 10中,增加了“使用无线局域网与蜂窝移动应用”的功能。有些App升级后默认关闭了数据使用,导致无法联网。

解决办法

1.进入“设置-蜂窝移动网络-使用无线局域网与蜂窝移动的应用”(或者“设置-无线局域网-使用无线局域网与蜂窝移动的应用”), 找到无法连网的App,允许其“使用无线局域网与蜂窝移动数据”即可。

2.另外还有一种Bug情况:在该列表中找不到这款无法联网的App,怎么办?

1)此时,在列表中任意选择一个App,先关闭“无线局域网与蜂窝移动数据“,即不允许其使用数据。然后再重新打开允许使用“无线局域网与蜂窝移动数据”。

2)返回桌面,再次打开刚才无法联网的App,这时候系统会提示“是否允许App使用数据网络”,点击“允许”,App即可顺利联网使用。

该情况主要出现在国行iPhone上,据说非国行的iPhone没有新增「是否允许“使用无线局域网与蜂窝移动应用”」的功能,因此不会出现这个问题。 在未来的iOS版本中,苹果应该会修复此Bug。

广告渠道说明

1.TapDB广告监测分为IP匹配和设备匹配

2.IP匹配使用方法都一样,填写下载链接,使用TapDB生成的投放链接代替原下载链接填入广告平台落地页处即可

3.设备匹配各个平台的使用方法不同,如果对设备匹配不太了解,请参考相应广告渠道的设备匹配投放说明

阿里汇川

阿里汇川有两种监测方式:

方式一:

监测推广单元:阿里汇川的推广单元只能配置一个转化,如果想要监测不同的推广单元,建议配置多个转化,和每个单元一一对应。

1.在TapDB创建阿里汇川的广告活动,并保存投放链接

Alt text

2.在阿里汇川后台-推广工具-转化工具-App行为中的点击发送地址处填入TapDB的投放链接

Alt text

3.在推广单元设置的出价设置中转化类型选择激活,选择配置好的转化名称即可

Alt text

方式二:

监测广告创意:可以给每个创意配置一个监测链接,监测不同创意的广告效果。

1.在TapDB创建阿里汇川的广告活动,并保存投放链接

Alt text

2.在创建广告创意时将TapDB的监测链接填入点击监测链接里

Alt text

AppsFlyer

1.在TapDB创建AppsFlyer的广告活动,并保存投放链接

Alt text

2.到AppsFlyer后台选择API数据接口,找到Push API,添加回传,只勾选Installs的non-organic,将TapDB生成的投放链接填入回传网址,如下图所示:

Alt text

Alt text

3.需要注意的是,AppsFlyer只要配置一条TapDB的链接,想看不同渠道的广告效果,TapDB在创建相应渠道的广告活动即可,每个广告活动生成的投放链接都是一样的。

Alt text

腾讯投放平台(新广点通)

每个标的物配置一个回调链接,监测不同广告的广告效果

1.在TapDB创建腾讯投放平台(新广点通)的广告活动,将广点通的账户ID填入TapDB进行授权

Alt text

2.授权成功后,将广点通工具箱-转化跟踪功能中的标的物ID填入TapDB(需要预先创建标的物)

Alt text

3.生成回调链接,将回调链接填入广点通工具箱-转化跟踪后台,在TapDB查看行为数据源ID,可以在DMP数据管理平台查看是否与项目对应

Alt text

今日头条

今日头条有两种广告监测方式

方式一:

监测广告计划:今日头条广告计划只能对应一个转化,如果想要监测不同的计划,建议配置多个转化,和每个计划一一对应。

1.在TapDB新建一个设备匹配的今日头条广告活动,保存生成的投放链接(点击回调链接)

Alt text

2.打开今日头条后台,选择 工具箱-优化辅助-转化跟踪,按照下图输入相应的链接

Alt text

3.创建广告计划时优化目标选择转化,转化类型选择激活,选择配置好的转化名称

Alt text

方法二:

监测广告创意:可以给每个创意配置一个监测链接,监测不同创意的广告效果。

1.在TapDB新建一个设备匹配的今日头条广告活动,保存生成的投放连接(点击回调连接)以及展示链接。

Alt text

2.在创建广告创意时,将TapDB生成的链接填入相应的位置

Alt text

Unityads

建议每个广告都配置一个监测链接,监测不同广告的广告效果

1.在TapDB创建Unityads的广告活动,并保存投放链接

Alt text

2.在Unityads的广告后台创建广告后,在广告计划设置中的第三方跟踪连接填入投放链接

Alt text

Vungle

建议每个广告都配置一个监测链接,监测不同广告的广告效果

1.在TapDB创建Vungle的广告活动,并保存投放链接

Alt text

2.在Vungle后台创建广告时,在追踪链接处填放TapDB的投放链接

Alt text

下载 SDK

接入 TapDB SDK,您就可以收集您的游戏运营数据并追踪广告效果。

如果你正在投放广点通、陌陌、百度原生信息流
兼容版支持额外获取IMEI号,支持监测广点通、陌陌、百度原生信息流,其他功能和正式版一致。
我们建议,如果你需要投放并监测这些广告平台,才选用兼容版。因为获取IMEI号可能会造成
  1. 涉及获取用户隐私
  2. 游戏在Google Play无法上架

功能指南

这里将介绍TapDB部分功能的使用指引。

包含了开发者和使用者经常会遇到的疑问,以及介绍功能如何使用的流程。

功能更新

这里将介绍TapDB更新的功能。

包含了网页版和APP的功能更新以及内容优化。

2018-09-06 V1.5.2 更新日志

新增

  1. 可以在消息中心接收到最新的通知
  2. 如果碰到问题,可以在设置-问题反馈中向我们反馈
  3. 付费数据新增推广费用曲线
  4. 来源下过滤条件筛选支持付费数据筛选

优化

  1. 游戏列表昨日数据根据项目时区变化
  2. 修复概览页面今日柱状图时间错位问题
  3. 过滤条件筛选交互优化
  4. 常用货币增加国家logo
  5. 优化网络环境较差时的交互与提示

2018-08-09 V1.5.1 更新日志

新增

  1. 新增DEMO入口

优化

  1. 修复部分场景下进入客户端闪退的问题

2018-07-31 V1.5.0​​ 更新日志

新增

  1. 项目根据项目所在时区显示数据
  2. 当你所在时区和项目时区不一致时,增加提示信息

优化

  1. 整体布局以及细节样式优化
  2. 优化数据显示样式,对未满足天数标红;今日数据标绿
  3. 下拉刷新体验优化
  4. 过滤条件页面支持右滑返回
  5. 无网络连接提示更新
  6. 修复表格全屏时样式问题
  7. 修复登录页1Password与清除图标重合的问题
  8. 解决TouchID/FaceID锁定状态下的问题
  9. 修复唤醒App后卡在开屏图的问题

2018-06-11 V1.4.4 更新日志

修复

  1. 修复在来源、活跃、付费下不能下拉刷新的bug

2018-06-11 V1.4.3 更新日志

新增

  1. 付费-用户模块新增了2、4、5、6日LTV数据
  2. 付费-周期模块改版,支持多日数据对比查看
  3. 付费下支持按“付费方式”“商品名称”查看数据
  4. 活跃-行为模块支持查看小时数据
  5. 新增“关于TapDB”,可查看当前版本以及功能介绍

优化

  1. 设置按钮位置调整到右上角
  2. 指纹解锁在开启后显示
  3. 修复iOS10,iPhone6闪退问题
  4. 表头内容显示优化

2018-05-14 V1.4.2​ 更新日志

新增

  1. 支持将当前设备加入测试白名单,用于测试新增数据
  2. 可以按照日、周、月查看活跃数据
  3. 增加顶部公告

优化

  1. 全面优化结构,提高App响应速度
  2. 概览支持右滑返回上一级界面
  3. 图表支持长按查看数据
  4. 已标记项目按照收入排序

2017-12-22 V1.3.0 更新日志

新增

  1. 游戏支持置顶,让你更快的找到常用游戏
  2. 来源中支持按照累计付费、首日付费、付费次数进行数据筛选
  3. 可以在设置中提交问题和建议

优化

  1. 游戏列表按照收入排序
  2. 界面布局优化
  3. 修复了过滤条件内搜索不全的bug
  4. 显示货币支持越南盾

2017-11-15 V1.1.0 更新日志

优化

  1. 适配iPhoneX

2017-10-20 V1.0.0 更新日志

新增

  1. 支持在概览页以及活跃下查看实时在线数据
  2. 可按照不同的货币类型查看收入数据

2018-08-03 更新日志

新功能

  1. 新增原始付费数据导出,可以在工具-数据导出中下载

修复

  1. 过滤条件在部分场景下的搜索排序问题
  2. 外部成员中复制链接的flash提示问题
  3. 收起侧边栏时的图表渲染问题

2018-07-27 更新日志

新功能

  1. 新版报表中心,下载同时可以进入其它页面看数据,未来将支持更多原始数据导出
  2. 新增特殊用户归类,可以将内部用户、刷榜用户、特殊用户标记为特殊广告渠道,方便查询和过滤
  3. 广点通支持授权模式
  4. 概览支持按日、周、月查询数据
  5. 广告默认查询有数据的广告,提高响应速度
  6. 广告增加硬件平台筛选

修复

  1. LTV指标优化,更精准地描述指标定义
  2. 修复部分场景下选择一日,没有显示小时的问题
  3. 搜索优先出精确匹配的结果
  4. 广告下使用设备、账号相关的过滤条件(如机型、地区)时,不展现点击信息,避免误解

2018-06-08 更新日志

新功能

  1. 首页游戏列表支持选择对比日期

  2. 付费支持按照商品查询数据 图片描述

  3. 官网全面更新

修复

  1. 部分场景下,总计显示乱码的问题
  2. 部分场景下,图表没有渲染的问题

2018-05-18 更新日志

新功能

  1. 用户价值(LTV) 支持查看第2、4、5、6日的数据
  2. TapDB开始支持多种语言了,目前支持 简体中文繁体中文英语,即将支持 韩语日语
  3. 设备白名单 ,如果需要测试新的分包渠道,新的广告是否调通,可以将设备加入白名单,这样可以在一台设备上反复测试不同渠道。

图片描述

修复

  1. 广告中的作弊主维度下,修复了存疑广告会将自己计算在内的问题

2018-05-04 更新日志

新功能

  1. 防作弊基础版 ,提供3种基础防作弊规则:点击IP离散作弊、激活IP离散作弊、点击激活时长作弊。

  2. 支持2个新的广告平台: 陌陌百度信息流ocpc

  3. 支付渠道 查询收入 图片描述

  4. 隐藏渠道 ,可以将不常用、测试、传递错误的渠道归类到隐藏渠道 图片描述

修复

1.概览下的新增设备未显示运营事件


广告概览

更新日期 2018-04-12

广告概览可以帮助你

  • 监控今日的点击、新增、转化是否正常

Alt text

  • 了解今日投放量Top10的广告平台

Alt text

  • 分析近30日的新用户获取趋势、支出和费用趋势

Alt text


导出细分数据

更新日期 2018-01-11

广告监测支持导出广告平台、广告、标签的细分数据,导出后方便查看每个广告下每天的数据

Alt text


小时活跃、周活跃和月活跃

更新日期 2017-12-15

1.现在可以查看不同日期粒度下的活跃了:

  • 小时活跃(HAU):日期选择某一天
  • 日活跃(DAU):日期选择某一段时间
  • 自然周活跃(WAU):活跃页面下切换到“周活跃”
  • 自然月活跃(MAU):活跃页面下切换到“月活跃”

其中周活跃、月活跃可以细分不同的分包渠道来查看渠道活跃明细。

Alt text

2.概览中增加月活跃曲线(MAU) Alt text


选择时区

更新日期 2017-12-06

创建项目的时候可以选择不同的时区,方便不同地区发行的游戏更好的分析数据

Alt text


显示货币

更新日期 2017-10-13

现在可以按照不同的货币类型来查看收入数据了

Alt text


数据导出

更新日期 2017-07-20

在工具中使用,可以根据广告平台或广告标签导出新增用户的具体信息,比如新增帐号,IDFA等

Alt text


操作日志

更新日期 2017-07-13

可在企业设置里查看操作日志,目前已上线项目、权限、广告三种日志类型,方便您更加快捷地了解项目状态、人员及权限变化、广告投放等情况。

Alt text


实时在线

更新日期 2017-07-12

“实时在线“功能可帮你进行实时在线分析,通过分钟级在线量展现实时现数据动态。 您可在 【工具-拓展功能】【在线分析】 中自主开启并使用了。

Alt text


180/360日LTV

更新日期 2017-07-07

运营和广告下增加180/360日LTV

  • 运营统计中可在付费-用户价值中查看
  • 广告监测中可在自定义列中添加并查看

对比日期

更新日期 2017-06-02

对比日期,在运营和广告模块增加对比日期功能,可以对不同时间段的数据进行对比,在图和表中均可查看对比数据的详情

Alt text


现在可以钉住常用的对比日了

更新日期 2017-05-25

在选择游戏概览中的对比日期时,新增了历史日记录功能,最多记录您最近5次选择的日期,您可以钉住其中常用的日期,并为之特殊命名,钉住的日期将一直保存,方便您下次使用。

Alt text


为渠道命名

更新日期 2017-04-16

可以对分包渠道的名称进行备注,在工具栏里可以使用

Alt text


存疑新增

更新日期 2017-04-16

广告页面增加存疑新增功能,标记了匹配了多个广告新增设备

测试设备白名单

当你需要用旧设备测试分包渠道或广告是否调通时,可以使用测试设备白名单功能来完成这个任务。

一、确保你的游戏已经接入了最新的SDK

白名单功能需要接入最新的TapDB SDK,具体版本号如下:

iOS:v1.9.2

Android:v1.9.2

Cocos2d-x:v1.3.2

Unity 3D:v1.4.2

下载SDK


二、添加测试设备

你可以使用2种方法添加测试设备:扫码添加、手动添加

方法一:扫码添加

1.下载TapDB移动客户端

图片描述

2.打开App

未登录:在登录界面左上角点击"!"进入添加页面

已登录:点击左上角“设置”-“测试设备”进入添加页面

图片描述

3.点击添加设备,扫描Web端“企业设置”-“测试设备”-“+添加设备”中的二维码

图片描述


方法二:手动添加

  1. 用Web端点击右上角菜单中的“企业设置”-“测试设备”-“+添加设备”
  2. 选择“自定义添加”
  3. 选择系统

图片描述

4.iOS填写IDFA

如何获取IDFA

  1. 下载TapDB客户端,点击测试设备,获取IDFA

5.Android填写Android ID或Google ID

如何获取Android ID或Google ID?

  1. 下载TapDB客户端,点击测试设备,获取Android ID和Google ID
  2. 获取Android ID:打开手机拨号键,输入*#*#8255#*#*
  3. 获取Google Advertising ID : https://support.google.com/googleplay/android-developer/answer/6048248?hl=en

注意事项:

  1. 每个企业支持添加30个设备
  2. 不建议添加模拟器设备,部分品牌的模拟器添加后,会导致所有使用该模拟器的设备都会被加入白名单
  3. 设备加入白名单后,将对该企业下的所有项目生效。
  4. 设备从白名单内移除后,后续数据将传递在首次激活的设备号上。

如果需要帮助,请联系我们的技术支持 QQ:3171097571 邮件:support@tapdb.com

1.简介

1.1.适用范围

TapDB提供一套SDK,游戏开发者可以将其集成到游戏中,系统会收集玩家数据,并进行分析,最终形成数据报表,帮助游戏开发者分析玩家行为并优化游戏。

目前SDK适用于Android 2.2及以上的系统。

1.2.名词解释

名词含义
玩家对应一个玩家账户,需要一个唯一的标识符。玩家是统计系统的数据统计基本单位
设备安装了对应游戏的设备
付费玩家使用真实货币换取游戏虚拟币或游戏道具
分包渠道标识游戏安装包渠道来源,需要在代码中设置

2.接入方式

2.1.申请应用

在TapDB控制台中注册一个游戏,获得游戏对应的APP ID,这是一个16位的字符串,iOS和Android可共用一个APP ID。

2.2.向工程中导入SDK

在TapDB网站上下载最新的SDK,其中包含一个库文件libTyrantdbGameTracker.jar,将该库文件加入到项目的引用库中。

2.3.添加Android支持库

添加Android v4支持库到项目中,Android v4支持库的版本必须不低于23.0.0,否则可能导致闪退。

如果使用gradle依赖安装版本高于24.2.0版本的v4支持库,可以仅安装support-compat模块,参见文档: https://developer.android.com/topic/libraries/support-library/setup.htmlhttps://developer.android.com/topic/libraries/support-library/features.html

如果不方便使用gradle进行自动化依赖安装,之前也没有使用到v4支持库,可以使用此处提供的support-compat模块的jar文件, https://static.tapdb.net/web/res/file/upload/2017/0926/android-support-v4.jar

2.4.添加需要的权限

需要为工程中的AndroidManifest.xml添加下列权限。当AndroidManifest.xml中配置的targetSdkVersion大于等于23,同时在初始化函数中设置requestPermission为true,并且运行在Android 6以上的设备时,TapDB SDK会主动提示用户进行可选权限授权。

权限是否必须用途
android.permission.INTERNET必选使用网络的权限
android.permission.ACCESS_NETWORK_STATE必选获取手机网络连接状态
android.permission.WRITE_EXTERNAL_STORAGE可选使用SD卡辅助存储设备标识等信息,若不具备此权限,有一部分设备无法进行很好的设备跟踪

2.5.调用统计接口

在需要调用统计接口的代码中引入类com.xindong.tyrantdb.TyrantdbGameTracker,并按照后面的接口介绍调用统计接口。

3.接口说明

libTyrantdbGameTracker.jar中包含了TyrantdbGameTracker类,并且TyrantdbGameTracker类中还定义了TGTUserType/TGTUserSex两个枚举类型。TyrantdbGameTracker包含的都是静态方法,直接用类名调用即可。TGTUserType表示玩家类型,TGTUserSex表示玩家性别。

3.1.初始化

初始化统计系统SDK,调用这个接口是使用其它接口的先决条件,需要尽早调用。一般建议在MainActivity的OnCreate中调用。

public static void init(Activity activity, String appId, String channel, String version, boolean requestPermission)
字段可为空说明
activity当前应用的Activity对象,一般传入MainActivity对象
appId注册游戏时获得的APP ID
channel分包渠道,1.2.名词解释中有介绍
version游戏版本,为空时,自动获取游戏安装包的版本(AndroidManifest.xml中的versionName)
requestPermission是否由TapDB SDK来申请上述可选权限。当AndroidManifest.xml中配置的targetSdkVersion大于等于23,同时该参数为true,并且运行在Android 6以上的设备时,TapDB SDK会主动申请APP申明的上述可选权限。

3.2.处理用户授权回调

为主activity实现android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback接口,实现其中的onRequestPermissionsResult方法,并且直接在方法中调用TapDB的onRequestPermissionsResult方法并传递收到的参数即可,若IDE报错,可以使用@SuppressLint("Override")忽略报错。

如果已经实现了该方法,在方法的最后加入调用TapDB的onRequestPermissionsResult方法并传递收到的参数即可。

需要注意,实现OnRequestPermissionsResultCallback接口的activity必须和传递给TapDB init方法中的activity是同一个。

当AndroidManifest.xml中定义的targetSdkVersion大于等于23,且初始化函数中设置requestPermission为true时,必须做此处理。建议无论什么场景都加上,防止以后更改时遗忘。

// 注意一定要为当前类实现android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback接口,而不是单纯加一个方法
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    TyrantdbGameTracker.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

3.3.跟踪游戏的启停

跟踪玩家游戏次数和游戏时长。需要给游戏中每个Activity的onResume和onStop中添加对应的调用,如果多个Activity继承同一个父类,只需要在父类中添加调用即可。比如onResume方法,直接在Activity的onResume方法的最后添加TyrantdbGameTracker.onResume(this)即可。

public static void onResume(final Activity activity)
public static void onStop(final Activity activity)
字段可为空说明
activity当前Activity对象,一般传入this

3.4.记录一个玩家

记录一个玩家(注意是平台用户,不是游戏角色!!!),当玩家登陆时调用,如果是试玩用户,userId由游戏自己生成,但需要保证唯一性。

public static void setUser(String userId, TGTUserType userType, TGTUserSex userSex, int userAge, String userName)
字段可为空说明
userId玩家ID(注意是平台用户ID,不是游戏角色ID!!!),不同玩家要是唯一的,不同用户平台可能存在相同的用户ID,需要想办法做区分
userType玩家类型,见类型详细定义
userSex玩家性别,见类型详细定义
userAge玩家年龄,无法获知玩家年龄直接传递0
userName玩家名称

3.5.玩家等级

设置玩家等级,玩家登陆时或升级时调用。

public static void setLevel(int level)
字段可为空说明
level玩家等级

3.6.玩家区服

设置玩家区服,玩家登陆时或更换区服时调用。

public static void setServer(String server)
字段可为空说明
server玩家服务器

3.7.发起充值请求

(推荐使用服务端充值统计接口)

当玩家发起充值请求时调用。

提醒:由于客户端行为,不可避免会有投机者尝试破解充值; 如果没有通过服务器校验,一定会造成数据不准确,强烈建议使用服务器接口进行充值数据回调。 (4.1.充值统计接口)

public static void onChargeRequest(String orderId, String product, long amount, String currencyType, long virtualCurrencyAmount, String payment)
字段可为空说明
orderId订单ID
product产品名称
amount充值金额(单位分,即无论什么币种,都需要乘以100)
currencyType货币类型,参考:人民币 CNY,美元 USD;欧元 EUR
virtualCurrencyAmount充值获得的虚拟币
payment支付方式,如:支付宝

3.8.充值成功

充值成功时调用,需要与充值请求成对调用

public static void onChargeSuccess(String orderId)
字段可为空说明
orderId订单ID,与之前调用的充值请求传递的ID对应

3.9.充值失败

充值失败时调用,需要与充值请求成对调用

public static void onChargeFail(String orderId, String reason)
字段可为空说明
orderId订单ID,与之前调用的充值请求传递的ID对应
reason失败原因

3.10.仅充值成功

当客户端无法跟踪充值请求发起,只能跟踪到充值成功的事件时,调用该接口记录充值信息

public static void onChargeOnlySuccess(String orderId, String product, long amount, String currencyType, long virtualCurrencyAmount, String payment)
字段可为空说明
orderId订单ID
product产品名称
amount充值金额(单位分,即无论什么币种,都需要乘以100)
currencyType货币类型,参考:人民币 CNY,美元 USD;欧元 EUR
virtualCurrencyAmount充值获得的虚拟币
payment支付方式,如:支付宝

4.服务端统计接口

4.1.充值统计接口

由于客户端接入充值统计可能会不太准确,这里提供服务端充值统计方法,需要忽略掉SDK中的相关充值统计接口

接口:https://e.tapdb.net/event
内容(注意后面还需要处理一下):
{
    "module": "GameAnalysis", //固定
    "ip": "8.8.8.8", //充值用户的IP,可选
    "name": "charge", //固定
    "index": "APPID", //APPID注意替换成TapDB的appid
    "identify": "user_id", //user_id,必须和客户端的setUser接口传递的user_id一样,并且该用户已经通过SDK接口进行过统计
    "properties": {
        "order_id": "100000", //order_id,可选,若传递此参数,需要保证order_id唯一,重复订单不计入统计
        "amount": 100, //充值金额(单位分,即无论什么币种,都需要乘以100),必传
        "virtual_currency_amount": 100, //获赠虚拟币数量,必传,可为0
        "currency_type": "CNY", //货币类型,可选,不传或者不是正确的货币类型,统一处理成人民币分
        "product": "item1", //充值包名称,可选
        "payment": "alipay" //充值途径,可选
    }
}

假如游戏的appid为abcd1234,构建出json字符串后,需要去掉空格和换行符,然后再进行一次urlencode,再把结果作为post数据发过来
先替换换行符和空格,变成:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount":100,"virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
然后urlencode,变成如下形式,某些版本的urlencode可能会把':'和','进行编码,不影响实际使用。
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

货币类型的格式参考汇率表

成功判断:返回的HTTP Code为200认为发送成功,否则认为失败

4.2.在线数据统计接口

由于SDK无法进行准确的在线数据统计,这里提供服务端在线数据统计接口。游戏服务端可以每隔5分钟自行统计在线人数,通过接口发送到TapDB,TapDB进行数据汇总和展现。

接口:https://se.tapdb.net/tapdb/online
方法:POST
格式:json
必须头信息:Content-Type: application/json

请求内容:

参数名参数类型参数说明
appidstringTapDB的appid
onlinesarray多条在线数据(最多100条)

其中onlines数组的结构为

参数名参数类型参数说明
serverstring服务器,TapDB对同一服务器每一个自然5分钟仅接受一次数据
onlineint在线人数
timestamplong当前统计数据的时间戳(秒),TapDB会按照自然5分钟进行数据对齐

示例:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

成功判断:返回的HTTP Code为200认为发送成功,否则认为失败

1.简介

1.1.适用范围

封装了TapDB的SDK,适用于 Cocos2d-x 开发的游戏,同时支持 iOS 和 Android 平台。

1.2.名词解释

名词含义
玩家对应一个玩家账户,需要一个唯一的标识符。玩家是统计系统的数据统计基本单位
设备安装了对应游戏的设备
付费玩家使用真实货币换取游戏虚拟币或游戏道具
分包渠道标识游戏安装包渠道来源,需要在代码中设置

2.接入方式

2.1.申请应用

在TapDB控制台中注册一个游戏,获得游戏对应的APP ID,这是一个16位的字符串,iOS和Android可共用一个APP ID。

2.2.向工程中导入SDK

在TapDB网站上下载最新的SDK,其中包含一个 TapDB_sdk.zip 文件,解压得到3个文件夹,include文件夹里面是头文件,iOS和Android文件夹里面是对应平台的实现代码和库文件。另外,在Android.mk里面添加对TapDB.cpp的引用。

2.3.添加Android支持库

添加Android v4支持库到项目中,Android v4支持库的版本必须不低于23.0.0,否则可能导致闪退。

如果使用gradle依赖安装版本高于24.2.0版本的v4支持库,可以仅安装support-compat模块,参见文档: https://developer.android.com/topic/libraries/support-library/setup.htmlhttps://developer.android.com/topic/libraries/support-library/features.html

如果不方便使用gradle进行自动化依赖安装,之前也没有使用到v4支持库,可以使用此处提供的support-compat模块的jar文件, https://static.tapdb.net/web/res/file/upload/2017/0926/android-support-v4.jar

2.4.Android添加需要的权限

需要为工程中的AndroidManifest.xml添加下列权限

权限是否必须用途
android.permission.INTERNET必选使用网络的权限
android.permission.ACCESS_NETWORK_STATE必选获取手机网络连接状态
android.permission.WRITE_EXTERNAL_STORAGE可选使用SD卡辅助存储设备标识等信息,若不具备此权限,有一部分设备无法进行很好的设备跟踪

2.5.iOS引入依赖的框架

需要为Xcode工程引入下列依赖的框架或库

框架或库用途
CoreTelephony.framework用来获取运营商标识
AdSupport.framework用来获取设备广告标识,跟踪设备
Security.framework用来进行更好的持久化存储

2.6.调用统计接口

在需要调用统计接口的代码中引入TapDB.h,并按照后面的接口介绍调用统计接口。

3.接口说明

TapDB.h包含了类TapDB,还定义了TGTUserType/TGTUserSex两个枚举类型。TapDB包含的都是静态方法,直接用类名调用即可。TGTUserType表示玩家类型,TGTUserSex表示玩家性别。

3.1.初始化

初始化统计系统SDK,调用这个接口是使用其它接口的先决条件,需要尽早调用。init 方法会初始化 SDK,在此之前不可以调用 SDK 的其他方法。

Android需要引入libTyrantdbGameTracker.jar,并且在主 Activity 的 onCreate() 中调用 TyrantdbGameTracker.init(Activity activity, String appId, String channelId, String version, bool requestPermission),最后一个参数固定传递false。

public static void onStart(string appId, string channel, string version)
字段可为空说明
appId注册游戏时获得的APP ID
channel分包渠道,1.2.名词解释中有介绍
version游戏版本,为空时,自动获取游戏安装包的版本

3.2.跟踪游戏的启停(只适用于Android)

跟踪玩家游戏次数和游戏时长。需要给游戏中每个Activity的onResume和onStop中添加对应的调用。如:在MainActivity里面调用TyrantdbGameTracker.onStop (this);即可。

public static void onResume(Context ctx)
public static void onStop(Context ctx)

3.3.记录一个玩家

记录一个玩家(注意是平台用户,不是游戏角色!!!),当玩家登陆时调用,如果是试玩用户,userId由游戏自己生成,但需要保证唯一性。

public static void setUser(const char *userId, TGTUserType userType, TGTUserSex userSex,
 int userAge, const char *userName)
字段可为空说明
userId玩家ID(注意是平台用户ID,不是游戏角色ID!!!),不同玩家要是唯一的,不同用户平台可能存在相同的用户ID,需要想办法做区分
userType玩家类型,见类型详细定义
userSex玩家性别,见类型详细定义
userAge玩家年龄,无法获知玩家年龄直接传递0
userName玩家名称

3.4.玩家等级

设置玩家等级,玩家登陆时或升级时调用。

public static void setLevel(int level)
字段可为空说明
level玩家等级

3.5.玩家区服

设置玩家区服,玩家登陆时或更换区服时调用。

public static void setServer(const char *server)
字段可为空说明
server玩家服务器

3.6.发起充值请求

(推荐使用服务端充值统计接口)

当玩家发起充值请求时调用。

提醒:由于客户端行为,不可避免会有投机者尝试破解充值; 如果没有通过服务器校验,一定会造成数据不准确,强烈建议使用服务器接口进行充值数据回调。 (4.1.充值统计接口)

public static void onChargeRequest(const char *orderId, const char *product,
 long amount, const char * currencyType, long virtualCurrencyAmount, const char *payment)
字段可为空说明
orderId订单ID
product产品名称
amount充值金额(单位分,即无论什么币种,都需要乘以100)
currencyType货币类型,参考:人民币 CNY,美元 USD;欧元 EUR
virtualCurrencyAmount充值获得的虚拟币
payment支付方式,如:支付宝

3.7.充值成功

充值成功时调用,需要与充值请求成对调用

public static void onChargeSuccess(const char *orderId)
字段可为空说明
orderId订单ID,与之前调用的充值请求传递的ID对应

3.8.充值失败

充值失败时调用,需要与充值请求成对调用

public static void onChargeFail(const char *orderId, const char *reason)
字段可为空说明
orderId订单ID,与之前调用的充值请求传递的ID对应
reason失败原因

3.9.仅充值成功

当客户端无法跟踪充值请求发起,只能跟踪到充值成功的事件时,调用该接口记录充值信息

public static void onChargeOnlySuccess(const char *orderId, const char *product,
long amount, const char *currencyType, long virtualCurrencyAmount, const char *payment)
字段可为空说明
orderId订单ID
product产品名称
amount充值金额(单位分,即无论什么币种,都需要乘以100)
currencyType货币类型,参考:人民币 CNY,美元 USD;欧元 EUR
virtualCurrencyAmount充值获得的虚拟币
payment支付方式,如:支付宝

4.服务端统计接口

4.1.充值统计接口

由于客户端接入充值统计可能会不太准确,这里提供服务端充值统计方法,需要忽略掉SDK中的相关充值统计接口

接口:https://e.tapdb.net/event
内容(注意后面还需要处理一下):
{
    "module": "GameAnalysis", //固定
    "ip": "8.8.8.8", //充值用户的IP,可选
    "name": "charge", //固定
    "index": "APPID", //APPID注意替换成TapDB的appid
    "identify": "user_id", //user_id,必须和客户端的setUser接口传递的user_id一样,并且该用户已经通过SDK接口进行过统计
    "properties": {
        "order_id": "100000", //order_id,可选,若传递此参数,需要保证order_id唯一,重复订单不计入统计
        "amount": 100, //充值金额(单位分,即无论什么币种,都需要乘以100),必传
        "virtual_currency_amount": 100, //获赠虚拟币数量,必传,可为0
        "currency_type": "CNY", //货币类型,可选,不传或者不是正确的货币类型,统一处理成人民币分
        "product": "item1", //充值包名称,可选
        "payment": "alipay" //充值途径,可选
    }
}

假如游戏的appid为abcd1234,构建出json字符串后,需要去掉空格和换行符,然后再进行一次urlencode,再把结果作为post数据发过来
先替换换行符和空格,变成:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount":100,"virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
然后urlencode,变成如下形式,某些版本的urlencode可能会把':'和','进行编码,不影响实际使用。
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

货币类型的格式参考汇率表

成功判断:返回的HTTP Code为200认为发送成功,否则认为失败

4.2.在线数据统计接口

由于SDK无法进行准确的在线数据统计,这里提供服务端在线数据统计接口。游戏服务端可以每隔5分钟自行统计在线人数,通过接口发送到TapDB,TapDB进行数据汇总和展现。

接口:https://se.tapdb.net/tapdb/online
方法:POST
格式:json
必须头信息:Content-Type: application/json

请求内容:

参数名参数类型参数说明
appidstringTapDB的appid
onlinesarray多条在线数据(最多100条)

其中onlines数组的结构为

参数名参数类型参数说明
serverstring服务器,TapDB对同一服务器每一个自然5分钟仅接受一次数据
onlineint在线人数
timestamplong当前统计数据的时间戳(秒),TapDB会按照自然5分钟进行数据对齐

示例:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

成功判断:返回的HTTP Code为200认为发送成功,否则认为失败

1.简介

1.1.适用范围

TapDB提供一套SDK,游戏开发者可以将其集成到游戏中,系统会收集玩家数据,并进行分析,最终形成数据报表,帮助游戏开发者分析玩家行为并优化游戏。

目前SDK适用于iOS 5.0及以上的系统,支持armv7/armv7s/arm64架构。

1.2.名词解释

名词含义
玩家对应一个玩家账户,需要一个唯一的标识符。玩家是统计系统的数据统计基本单位
设备安装了对应游戏的设备
付费玩家使用真实货币换取游戏虚拟币或游戏道具
分包渠道标识游戏安装包渠道来源,需要在代码中设置

2.接入方式

2.1.申请应用

在TapDB控制台中注册一个游戏,获得游戏对应的APP ID,这是一个16位的字符串,iOS和Android可共用一个APP ID。

2.2.向Xcode工程中导入SDK

在TapDB网站上下载最新的SDK,其中包含一个头文件TyrantdbGameTracker.h和一个静态链接库文件libTyrantdbGameTracker.a。将两个文件导入到Xcode工程中,并确保所有需要用到SDK的Target都链接到静态库文件。

2.3.引入依赖的框架

需要为Xcode工程引入下列依赖的框架或库

框架或库用途
CoreTelephony.framework用来获取运营商标识
AdSupport.framework用来获取设备广告标识,跟踪设备
Security.framework用来进行更好的持久化存储

2.4.调用统计接口

在需要调用统计接口的代码中引入头文件TyrantdbGameTracker.h,并按照后面的接口介绍调用统计接口。

3.接口说明

头文件中定义了一个TyrantdbGameTracker类和TGTUserType/TGTUserSex两个枚举类型。TyrantdbGameTracker包含的都是静态方法,直接用类名调用即可。TGTUserType表示玩家类型,TGTUserSex表示玩家性别。

3.1.初始化

初始化统计系统SDK,调用这个接口是使用其它接口的先决条件,需要尽早调用。一般建议在AppDelegate的application:didFinishLaunchingWithOptions:中调用。

+ (void)onStart:(NSString *)appId channel:(NSString *)channel version:(NSString *)version;
字段可为空说明
appId注册游戏时获得的APP ID
channel分包渠道,1.2.名词解释中有介绍
version游戏版本,为空时,自动获取游戏安装包的版本(Xcode配置中的Version)

3.2.记录一个玩家

记录一个玩家(注意是平台用户,不是游戏角色!!!),当玩家登陆时调用,如果是试玩用户,userId由游戏自己生成,但需要保证唯一性。

+ (void)setUser:(NSString *)userId userType:(TGTUserType)userType userSex:(TGTUserSex)userSex userAge:(NSInteger)userAge userName:(NSString *)userName;
字段可为空说明
userId玩家ID(注意是平台用户ID,不是游戏角色ID!!!),不同玩家要是唯一的,不同用户平台可能存在相同的用户ID,需要想办法做区分
userType玩家类型,见类型详细定义
userSex玩家性别,见类型详细定义
userAge玩家年龄,无法获知玩家年龄直接传递0
userName玩家名称

3.3.玩家等级

设置玩家等级,玩家登陆时或升级时调用。

+ (void)setLevel:(NSInteger)level;
字段可为空说明
level玩家等级

3.4.玩家区服

设置玩家区服,玩家登陆时或更换区服时调用。

+ (void)setServer:(NSString *)server;
字段可为空说明
server玩家服务器

3.5.发起充值请求

(推荐使用服务端充值统计接口)

当玩家发起充值请求时调用。

提醒:由于客户端行为,不可避免会有投机者尝试破解充值; 如果没有通过服务器校验,一定会造成数据不准确,强烈建议使用服务器接口进行充值数据回调。 (4.1.充值统计接口)

+ (void)onChargeRequest:(NSString *)orderId product:(NSString *)product amount:(NSInteger)amount currencyType:(NSString *)currencyType virtualCurrencyAmount:(NSInteger)virtualCurrencyAmount payment:(NSString *)payment;
字段可为空说明
orderId订单ID
product产品名称
amount充值金额(单位分,即无论什么币种,都需要乘以100)
currencyType货币类型,参考:人民币 CNY,美元 USD;欧元 EUR
virtualCurrencyAmount充值获得的虚拟币
payment支付方式,如:支付宝

3.6.充值成功

充值成功时调用,需要与充值请求成对调用

+ (void)onChargeSuccess:(NSString *)orderId;
字段可为空说明
orderId订单ID,与之前调用的充值请求传递的ID对应

3.7.充值失败

充值失败时调用,需要与充值请求成对调用

+ (void)onChargeFail:(NSString *)orderId reason:(NSString *)reason;
字段可为空说明
orderId订单ID,与之前调用的充值请求传递的ID对应
reason失败原因

3.8.仅充值成功

当客户端无法跟踪充值请求发起,只能跟踪到充值成功的事件时,调用该接口记录充值信息

+ (void)onChargeOnlySuccess:(NSString *)orderId product:(NSString *)product amount:(NSInteger)amount currencyType:(NSString *)currencyType virtualCurrencyAmount:(NSInteger)virtualCurrencyAmount payment:(NSString *)payment;
字段可为空说明
orderId订单ID
product产品名称
amount充值金额(单位分,即无论什么币种,都需要乘以100)
currencyType货币类型,参考:人民币 CNY,美元 USD;欧元 EUR
virtualCurrencyAmount充值获得的虚拟币
payment支付方式,如:支付宝

4.服务端统计接口

4.1.充值统计接口

由于客户端接入充值统计可能会不太准确,这里提供服务端充值统计方法,需要忽略掉SDK中的相关充值统计接口

接口:https://e.tapdb.net/event
内容(注意后面还需要处理一下):
{
    "module": "GameAnalysis", //固定
    "ip": "8.8.8.8", //充值用户的IP,可选
    "name": "charge", //固定
    "index": "APPID", //APPID注意替换成TapDB的appid
    "identify": "user_id", //user_id,必须和客户端的setUser接口传递的user_id一样,并且该用户已经通过SDK接口进行过统计
    "properties": {
        "order_id": "100000", //order_id,可选,若传递此参数,需要保证order_id唯一,重复订单不计入统计
        "amount": 100, //充值金额(单位分,即无论什么币种,都需要乘以100),必传
        "virtual_currency_amount": 100, //获赠虚拟币数量,必传,可为0
        "currency_type": "CNY", //货币类型,可选,不传或者不是正确的货币类型,统一处理成人民币分
        "product": "item1", //充值包名称,可选
        "payment": "alipay" //充值途径,可选
    }
}

假如游戏的appid为abcd1234,构建出json字符串后,需要去掉空格和换行符,然后再进行一次urlencode,再把结果作为post数据发过来
先替换换行符和空格,变成:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount":100,"virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
然后urlencode,变成如下形式,某些版本的urlencode可能会把':'和','进行编码,不影响实际使用。
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

货币类型的格式参考汇率表

成功判断:返回的HTTP Code为200认为发送成功,否则认为失败

4.2.在线数据统计接口

由于SDK无法进行准确的在线数据统计,这里提供服务端在线数据统计接口。游戏服务端可以每隔5分钟自行统计在线人数,通过接口发送到TapDB,TapDB进行数据汇总和展现。

接口:https://se.tapdb.net/tapdb/online
方法:POST
格式:json
必须头信息:Content-Type: application/json

请求内容:

参数名参数类型参数说明
appidstringTapDB的appid
onlinesarray多条在线数据(最多100条)

其中onlines数组的结构为

参数名参数类型参数说明
serverstring服务器,TapDB对同一服务器每一个自然5分钟仅接受一次数据
onlineint在线人数
timestamplong当前统计数据的时间戳(秒),TapDB会按照自然5分钟进行数据对齐

示例:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

成功判断:返回的HTTP Code为200认为发送成功,否则认为失败

接入文档

对接SDK的开发者请仔细阅读

1.目前支持iOS、Android、U3D、cocos的SDK及文档方便开发者选择

2.已传递的数据不可修改,请正确传递渠道,玩家,收入等相关数据,以便后续的数据分析

3.充值和玩家在线数据提供服务端传递方式,让数据更加准确

4.接入时遇到任何问题,可以联系技术支持QQ: 3485772949

SDK文档

1.简介

1.1.适用范围

TapDB提供一套SDK,游戏开发者可以将其集成到游戏中,系统会收集玩家数据,并进行分析,最终形成数据报表,帮助游戏开发者分析玩家行为并优化游戏。

适用于Unity开发的游戏,Android支持2.2及以上的系统,iOS支持5.0及以上的系统。

1.2.名词解释

名词含义
玩家对应一个玩家账户,需要一个唯一的标识符。玩家是统计系统的数据统计基本单位
设备安装了对应游戏的设备
付费玩家使用真实货币换取游戏虚拟币或游戏道具
分包渠道标识游戏安装包渠道来源,需要在代码中设置

2.接入方式

2.1.申请应用

在TapDB控制台中注册一个游戏,获得游戏对应的APP ID,这是一个16位的字符串,iOS和Android可共用一个APP ID。

2.2.向工程中导入SDK

在TapDB网站上下载最新的SDK,其中包含一个 TapDB.unitypackage 文件,在 Unity3D 编译器中选择 Assets --> Import Package --> Custom Package 找到 TapDB.unitypackage 文件,点击"打开按钮"即可导入成功。其中demo.cs仅是示例代码,不是SDK所需的代码。

2.3.添加Android支持库

添加Android v4支持库到项目中,Android v4支持库的版本必须不低于23.0.0,否则可能导致闪退。

如果使用gradle依赖安装版本高于24.2.0版本的v4支持库,可以仅安装support-compat模块,参见文档: https://developer.android.com/topic/libraries/support-library/setup.htmlhttps://developer.android.com/topic/libraries/support-library/features.html

如果不方便使用gradle进行自动化依赖安装,之前也没有使用到v4支持库,可以使用此处提供的support-compat模块的jar文件, https://static.tapdb.net/web/res/file/upload/2017/0926/android-support-v4.jar

2.4.Android添加需要的权限

需要为工程中的AndroidManifest.xml添加下列权限。当AndroidManifest.xml中配置的targetSdkVersion大于等于23,同时在初始化函数中设置requestPermission为true,并且运行在Android 6以上的设备时,TapDB SDK会主动提示用户进行可选权限授权。

权限是否必须用途
android.permission.INTERNET必选使用网络的权限
android.permission.ACCESS_NETWORK_STATE必选获取手机网络连接状态
android.permission.WRITE_EXTERNAL_STORAGE可选使用SD卡辅助存储设备标识等信息,若不具备此权限,有一部分设备无法进行很好的设备跟踪

2.5.iOS引入依赖的框架

需要为iOS导出的Xcode工程引入下列依赖的框架或库

框架或库用途
CoreTelephony.framework用来获取运营商标识
AdSupport.framework用来获取设备广告标识,跟踪设备
Security.framework用来进行更好的持久化存储

2.6.调用统计接口

在需要调用统计接口的代码中引入类TapDB,并按照后面的接口介绍调用统计接口。

3.接口说明

TapDB类中定义了TGTUserType/TGTUserSex两个枚举类型。TapDB包含的都是静态方法,直接用类名调用即可。TGTUserType表示玩家类型,TGTUserSex表示玩家性别。

3.1.初始化

初始化统计系统SDK,调用这个接口是使用其它接口的先决条件,需要尽早调用。一般建议在Unity里的Start()里面调用。

public static void onStart(string appId, string channel, string gameVersion, bool requestPermission)
字段可为空说明
appId注册游戏时获得的APP ID
channel分包渠道,1.2.名词解释中有介绍
gameVersion游戏版本,为空时,自动获取游戏安装包的版本(Android是AndroidManifest.xml中的versionName,iOS是Xcode配置中的Version)
requestPermission在Android上是否由TapDB SDK来申请上述可选权限。当AndroidManifest.xml中配置的targetSdkVersion大于等于23,同时该参数为true,并且运行在Android 6以上的设备时,TapDB SDK会主动申请APP申明的上述可选权限。

3.2.Android处理用户授权回调

为主activity实现android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback接口,实现其中的onRequestPermissionsResult方法,并且直接在方法中调用TapDB的onRequestPermissionsResult方法并传递收到的参数即可,若IDE报错,可以使用@SuppressLint("Override")忽略报错。

如果已经实现了该方法,在方法的最后加入调用代码即可。

主activity一般是继承com.unity3d.player.UnityPlayerActivity的子类,并且需要在AndroidManifest.xml中指定为主activity。

当AndroidManifest.xml中定义的targetSdkVersion大于等于23,且初始化函数中设置requestPermission为true时,必须做此处理。建议无论什么场景都加上,防止以后更改时遗忘。

// 注意一定要为当前类实现android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback接口,而不是单纯加一个方法
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    try {
        Class<?> clazz = Class.forName("com.xindong.tyrantdb.TyrantdbGameTracker");
        Method method = clazz.getMethod("onRequestPermissionsResult", int.class, String[].class, int[].class);
        method.invoke(null, requestCode, permissions, grantResults);
    } catch (ClassNotFoundException e) {
    } catch (NoSuchMethodException e) {
    } catch (IllegalAccessException e) {
    } catch (IllegalArgumentException e) {
    } catch (InvocationTargetException e) {
    }
}

由于代码中用到了反射调用,混淆代码时,请不要对com.xindong.tyrantdb.TyrantdbGameTracker进行混淆

3.3.跟踪游戏的启停

跟踪玩家游戏次数和游戏时长。可参照SDK demo中的方式进行调用。

public static void onResume()
public static void onStop()

3.4.记录一个玩家

记录一个玩家(注意是平台用户,不是游戏角色!!!),当玩家登陆时调用,如果是试玩用户,userId由游戏自己生成,但需要保证唯一性。

public static void setUser(string userId, TGTUserType userType, TGTUserSex userSex, int userAge, string userName)
字段可为空说明
userId玩家ID(注意是平台用户ID,不是游戏角色ID!!!),不同玩家要是唯一的,不同用户平台可能存在相同的用户ID,需要想办法做区分
userType玩家类型,见类型详细定义
userSex玩家性别,见类型详细定义
userAge玩家年龄,无法获知玩家年龄直接传递0
userName玩家名称

3.5.玩家等级

设置玩家等级,玩家登陆时或升级时调用。

public static void setLevel(int level)
字段可为空说明
level玩家等级

3.6.玩家区服

设置玩家区服,玩家登陆时或更换区服时调用。

public static void setServer(string server)
字段可为空说明
server玩家服务器

3.7.发起充值请求

(推荐使用服务端充值统计接口)

当玩家发起充值请求时调用。

提醒:由于客户端行为,不可避免会有投机者尝试破解充值; 如果没有通过服务器校验,一定会造成数据不准确,强烈建议使用服务器接口进行充值数据回调。 (4.1.充值统计接口)

public static void onChargeRequest(string orderId, string product, Int32 amount, string currencyType, Int32 virtualCurrencyAmount, string payment)
字段可为空说明
orderId订单ID
product产品名称
amount充值金额(单位分,即无论什么币种,都需要乘以100)
currencyType货币类型,参考:人民币 CNY,美元 USD;欧元 EUR
virtualCurrencyAmount充值获得的虚拟币
payment支付方式,如:支付宝

3.8.充值成功

充值成功时调用,需要与充值请求成对调用

public static void onChargeSuccess(string orderId)
字段可为空说明
orderId订单ID,与之前调用的充值请求传递的ID对应

3.9.充值失败

充值失败时调用,需要与充值请求成对调用

public static void onChargeFail(string orderId, string reason)
字段可为空说明
orderId订单ID,与之前调用的充值请求传递的ID对应
reason失败原因

3.10.仅充值成功

当客户端无法跟踪充值请求发起,只能跟踪到充值成功的事件时,调用该接口记录充值信息

public static void onChargeOnlySuccess(string orderId, string product, Int32 amount, string currencyType, Int32 virtualCurrencyAmount, string payment)
字段可为空说明
orderId订单ID
product产品名称
amount充值金额(单位分,即无论什么币种,都需要乘以100)
currencyType货币类型,参考:人民币 CNY,美元 USD;欧元 EUR
virtualCurrencyAmount充值获得的虚拟币
payment支付方式,如:支付宝

4.服务端统计接口

4.1.充值统计接口

由于客户端接入充值统计可能会不太准确,这里提供服务端充值统计方法,需要忽略掉SDK中的相关充值统计接口

接口:https://e.tapdb.net/event
内容(注意后面还需要处理一下):
{
    "module": "GameAnalysis", //固定
    "ip": "8.8.8.8", //充值用户的IP,可选
    "name": "charge", //固定
    "index": "APPID", //APPID注意替换成TapDB的appid
    "identify": "user_id", //user_id,必须和客户端的setUser接口传递的user_id一样,并且该用户已经通过SDK接口进行过统计
    "properties": {
        "order_id": "100000", //order_id,可选,若传递此参数,需要保证order_id唯一,重复订单不计入统计
        "amount": 100, //充值金额(单位分,即无论什么币种,都需要乘以100),必传
        "virtual_currency_amount": 100, //获赠虚拟币数量,必传,可为0
        "currency_type": "CNY", //货币类型,可选,不传或者不是正确的货币类型,统一处理成人民币分
        "product": "item1", //充值包名称,可选
        "payment": "alipay" //充值途径,可选
    }
}

假如游戏的appid为abcd1234,构建出json字符串后,需要去掉空格和换行符,然后再进行一次urlencode,再把结果作为post数据发过来
先替换换行符和空格,变成:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount":100,"virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
然后urlencode,变成如下形式,某些版本的urlencode可能会把':'和','进行编码,不影响实际使用。
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

货币类型的格式参考汇率表

成功判断:返回的HTTP Code为200认为发送成功,否则认为失败

4.2.在线数据统计接口

由于SDK无法进行准确的在线数据统计,这里提供服务端在线数据统计接口。游戏服务端可以每隔5分钟自行统计在线人数,通过接口发送到TapDB,TapDB进行数据汇总和展现。

接口:https://se.tapdb.net/tapdb/online
方法:POST
格式:json
必须头信息:Content-Type: application/json

请求内容:

参数名参数类型参数说明
appidstringTapDB的appid
onlinesarray多条在线数据(最多100条)

其中onlines数组的结构为

参数名参数类型参数说明
serverstring服务器,TapDB对同一服务器每一个自然5分钟仅接受一次数据
onlineint在线人数
timestamplong当前统计数据的时间戳(秒),TapDB会按照自然5分钟进行数据对齐

示例:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

成功判断:返回的HTTP Code为200认为发送成功,否则认为失败

1.對接問題

Q:單機遊戲的userId如何儲存?

A:單機遊戲的userId需要注意以下幾點:

(1)iOS得自己生成一個ID存到證書空間,iOS有個存儲空間,一個是應用,一個是證書(企業)。

(2)安卓儘量存到SD卡,用一個用戶操作或者1分鐘後調用setUser。

(3)隨機生成一個唯一用戶ID,並保存到本地,以後都用它。


Q:爲什麼SDK接入後沒有新增數據?

A:請檢查SDK初始化有沒有調用成功,失敗的話會有相應的失敗日誌,並確認初始化是最早調用的。


Q:服務端和客戶端都需要傳遞充值數據麼?

A:服務端和客戶端只需要選擇其中一種方式傳遞充值數據,同時使用數據會傳遞兩份,收入就會翻倍。


Q:爲什麼服務端傳遞充值數據TapDB頁面沒有顯示收入或者收入比實際要多?

A:首先服務端和客戶端的接口只能用其中一個(都使用的話會紀錄雙份充值,並確保充值成功再發送充值數據),其次服務端”identify”: “user_id”裏的user_id和文檔“紀錄一個玩家”中的setUser裏的“userId”需要保持一致。


Q:爲什麼實時在線數據發送後TapDB顯示沒有數據?

A:沒有顯示數據可能有以下幾種原因:

(1)檢查文件格式,參數類型(返回400報錯說明格式不對)

(2)注意時間戳單位(秒),並且只能發送近7日數據,太早的數據不會紀錄保存

(3)注意:是否有必須頭信息:Content-Type: application/json


Q:可以爲空的參數可以不填麼?

A:不可以,可以爲空的地方參數填null。


Q:爲什麼填了channel在TapDB裏找不到這個分包渠道?

A:必須要有一個新增數據TapDB才能接收到這個渠道,才能在這個頁面裏顯示這個分包渠道。


2.常見問題

Q:如何查看各種維度下的數據?

A:在來源,在線,留存,付費四個頁面裏的表格中都有主維度的切換選項,每個維度下顯示的數據都不同,可以根據不同情況來查看各個維度下的數據。


Q:什麼是分包渠道?

A:分包渠道就是聯運平臺,也就是這個包即將上線的平臺,在初始化的channel中傳遞該參數,比如說,這個包上架App Store,就傳遞App Store即可,後續可以只看該分包渠道的數據,方便篩選優質的聯運平臺。


Q:如何使用過濾條件?

A:過濾條件可以根據不同的選項,不同的範圍來選擇TapDB表格內展現的數據,方便區分各種類型的用戶。可以添加多個過濾條件來精確篩選滿足條件的數據,也可以保存設定好的過濾條件方便下次使用。


Q:爲什麼來源的收入比實際的收入要少?

A:來源只顯示新增用戶的付費收入情況,老用戶的付費情況請在付費頁面查看。


Q:爲什麼遊戲的轉化率很低?

A:轉化率低可能有以下幾種原因:

(1)技術人員確保SDK在用戶登錄的時候調用了setUser。

(2)運營人員注意是否有大量的新增設備,可能有作弊機器在刷新增。


3.廣告相關問題

Q:如何創建廣告計劃?

A:進入TapDB,廣告頁面,點擊廣告管理,選擇右上角的新增廣告活動,選擇廣告平臺,注意看下匹配方式,填寫信息,生成投放鏈接。


Q:什麼是IP匹配?

A:IP匹配是通過用戶點擊廣告時的IP和打開遊戲時的IP是否一致進行匹配的,適用所有廣告。創建廣告活動時如果沒有發現對應平臺可以創建自定義廣告。


Q:什麼是設備匹配?

A:設備匹配是TapDB和廣告平臺已經對接完成,廣告平臺將點擊廣告的數據返回TapDB,通過設備信息來匹配新增用戶的,十分精準,但僅使用於和TapDB對接完成的廣告平臺。


Q:IP匹配和設備匹配怎麼投放?

A:TapDB的廣告匹配分爲IP匹配和設備匹配:

IP匹配: 在新增廣告活動時,選擇廣告平臺,IP匹配的廣告平臺都有標註,且IP匹配的廣告需要填寫下載鏈接,生成鏈接後,直接將IP匹配生成的投放鏈接填入廣告平臺的落地頁URL即可。

設備匹配: 設備匹配填寫相應參數後可以直接生成回調鏈接,填入廣告平臺的第三方監控鏈接(名稱可能不同)中即可,落地頁URL填寫遊戲本身的下載地址。


Q:不能使用TapDB的鏈接投放廣告時怎麼辦?

A:比如說遊戲的域名是a.b.c,需要把a.b.c以CNAME的形式解析到l.tapdb.net,然後如果TapDB給出的連接是https://l.tapdb.net/xxxx,直接替換l.tapdb.net爲a.b.c,https改爲http,變成http://a.b.c/xxxx,使用該鏈接投遞廣告。


Q:爲什麼投放廣告匹配到其他系統的玩家?

A:廣告匹配到其他系統的玩家可能有以下原因:

(1)投放在web上,iOS和Android用戶都會被匹配

(2)iOS的投放鏈接,Android用戶(能看到該廣告)可能會點擊後主動去搜索該app下載,就會被匹配上,同理Android廣告也可能被iOS用戶匹配。

常見問題

這裡將提供使用TapDB中遇到的問題的解決方案。

包含了對接問題、數據相關問題、廣告相關問題以及其他可能遇見的問題。

TapDB無網絡連接問題解決方案

如果你遇到了“無網絡連接”的問題,可以按照下面的解決方案進行嘗試。

問題原因

蘋果在iOS 10中,增加了“使用無線局域網與蜂窩移動應用”的功能。有些App升級後默認關閉了數據使用,導致無法聯網。

解決辦法

1.進入“設置-蜂窩移動網絡-使用無線局域網與蜂窩移動的應用”(或者“設置-無線局域網-使用無線局域網與蜂窩移動的應用”), 找到無法連網的App,允許其“使用無線局域網與蜂窩移動數據”即可。

2.另外還有一種Bug情況:在該列表中找不到這款無法聯網的App,怎麼辦?

1)此時,在列表中任意選擇一個App,先關閉“無線局域網與蜂窩移動數據“,即不允許其使用數據。然後再重新打開允許使用“無線局域網與蜂窩移動數據”。

2)返回桌面,再次打開剛才無法聯網的App,這時候系統會提示“是否允許App使用數據網絡”,點擊“允許”,App即可順利聯網使用。

該情況主要出現在國行iPhone上,據說非國行的iPhone沒有新增「是否允許“使用無線局域網與蜂窩移動應用”」的功能,因此不會出現這個問題。 在未來的iOS版本中,蘋果應該會修復此Bug。

廣告渠道說明

1.TapDB廣告監測分爲IP匹配和設備匹配

2.IP匹配使用方法都一樣,填寫下載鏈接,使用TapDB生成的投放鏈接代替原下載鏈接填入廣告平臺落地頁處即可

3.設備匹配各個平臺的使用方法不同,如果對設備匹配不太瞭解,請參考相應廣告渠道的設備匹配投放說明

阿里匯川

阿里匯川有兩種監測方式:

方式一:

監測推廣單元:阿里匯川的推廣單元只能配置一個轉化,如果想要監測不同的推廣單元,建議配置多個轉化,和每個單元一一對應。

1.在TapDB創建阿里匯川的廣告活動,並保存投放鏈接

Alt text

2.在阿里匯川后臺-推廣工具-轉化工具-App行爲中的點擊發送地址處填入TapDB的投放鏈接

Alt text

3.在推廣單元設置的出價設置中轉化類型選擇激活,選擇配置好的轉化名稱即可

Alt text

方式二:

監測廣告創意:可以給每個創意配置一個監測鏈接,監測不同創意的廣告效果。

1.在TapDB創建阿里匯川的廣告活動,並保存投放鏈接

Alt text

2.在創建廣告創意時將TapDB的監測鏈接填入點擊監測鏈接裏

Alt text

AppsFlyer

1.在TapDB創建AppsFlyer的廣告活動,並保存投放鏈接

Alt text

2.到AppsFlyer後臺選擇API數據接口,找到Push API,添加回傳,只勾選Installs的non-organic,將TapDB生成的投放鏈接填入回傳網址,如下圖所示:

Alt text

Alt text

3.需要注意的是,AppsFlyer只要配置一條TapDB的鏈接,想看不同渠道的廣告效果,TapDB在創建相應渠道的廣告活動即可,每個廣告活動生成的投放鏈接都是一樣的。

Alt text

騰訊投放平台(新廣點通)

每個標的物配置一個回調鏈接,監測不同廣告的廣告效果

1.在TapDB創建騰訊投放平台(新廣點通)的廣告活動,將廣點通的賬戶ID填入TapDB進行授權

Alt text

2.授權成功後,將廣點通工具箱-轉化跟踪功能中的標的物ID填入TapDB(需要預先創建標的物)

Alt text

3.生成回調鏈接,將回調鏈接填入廣點通工具箱-轉化跟踪後台,在TapDB查看行為數據源ID,可以在DMP數據管理平台查看是否與項目對應

Alt text

今日頭條

今日頭條有兩種廣告監測方式

方式一:

監測廣告計劃:今日頭條廣告計劃只能對應一個轉化,如果想要監測不同的計劃,建議配置多個轉化,和每個計劃一一對應。

1.在TapDB新建一個設備匹配的今日頭條廣告活動,保存生成的投放鏈接(點擊回調鏈接)

Alt text

2.打開今日頭條後臺,選擇 工具箱-優化輔助-轉化跟蹤,按照下圖輸入相應的鏈接

Alt text

3.創建廣告計劃時優化目標選擇轉化,轉化類型選擇激活,選擇配置好的轉化名稱

Alt text

方法二:

監測廣告創意:可以給每個創意配置一個監測鏈接,監測不同創意的廣告效果。

1.在TapDB新建一個設備匹配的今日頭條廣告活動,保存生成的投放連接(點擊回調連接)以及展示鏈接。

Alt text

2.在創建廣告創意時,將TapDB生成的鏈接填入相應的位置

Alt text

Unityads

建議每個廣告都配置一個監測鏈接,監測不同廣告的廣告效果

1.在TapDB創建Unityads的廣告活動,並保存投放鏈接

Alt text

2.在Unityads的廣告後臺創建廣告後,在廣告計劃設置中的第三方跟蹤連接填入投放鏈接

Alt text

Vungle

建議每個廣告都配置一個監測鏈接,監測不同廣告的廣告效果

1.在TapDB創建Vungle的廣告活動,並保存投放鏈接

Alt text

2.在Vungle後臺創建廣告時,在追蹤鏈接處填放TapDB的投放鏈接

Alt text

下載 SDK

接入 TapDB SDK,您就可以收集您的遊戲運營數據並追蹤廣告效果。

如果你正在投放廣點通、陌陌、百度原生信息流
兼容版支持額外獲取IMEI號,支持監測廣點通、陌陌、百度原生信息流,其他功能和正式版一致。
我們建議,如果你需要投放並監測廣點通,才選用兼容版。因爲獲取IMEI號可能會造成
  1. 涉及獲取用戶隱私
  2. 遊戲在Google Play無法上架

功能指南

這裏將介紹TapDB部分功能的使用指引。

包含了開發者和使用者經常會遇到的疑問,以及介紹功能如何使用的流程。

功能更新

這裡將介紹TapDB更新的功能。

包含了網頁版和APP的功能更新以及內容優化。

2018-09-06 V1.5.2 更新日誌

新增

  1. 可以在消息中心接收到最新的通知
  2. 如果碰到問題,可以在設置-問題反饋中向我們反饋
  3. 付費數據新增推廣費用曲線
  4. 來源下過濾條件篩選支持付費數據篩選

優化

  1. 遊戲列表昨日數據根據項目時區變化
  2. 修復概覽頁面今日柱狀圖時間錯位問題
  3. 過濾條件篩選交互優化
  4. 常用貨幣增加國家logo
  5. 優化網絡環境較差時的交互與提示

2018-08-09 V1.5.1 更新日誌

新增

  1. 新增DEMO入口

優化

  1. 修復部分場景下進入客戶端閃退的問題

2018-07-31 V1.5.0​​ 更新日誌

新增

  1. 項目根據項目所在時區顯示數據
  2. 當妳所在時區和項目時區不壹致時,增加提示信息

優化

  1. 整體布局以及細節樣式優化
  2. 優化數據顯示樣式,對未滿足天數標紅;今日數據標綠
  3. 下拉刷新體驗優化
  4. 過濾條件頁面支持右滑返回
  5. 無網絡連接提示更新
  6. 修復表格全屏時樣式問題
  7. 修復登錄頁的1Password與清除圖標重合的問題
  8. 解決TouchID / FaceID鎖定狀態下的問題
  9. 修復喚醒App後卡在開屏圖的問題

2018-06-11 V1.4.4 更新日誌

修復

  1. 修復在來源,活躍,付費下不能下拉刷新的錯誤

2018-06-11 V1.4.3 更新日誌

新增

  1. 付費 - 用戶模塊新增了2,4,5,6日LTV數據
  2. 付費 - 週期模塊改版,支持多日數據對比查看
  3. 付費下支持按“付費方式”,“商品名稱”查看數據
  4. 活躍 - 行為模塊支持查看小時數據
  5. 新增“關於TapDB”,可查看當前版本以及功能介紹

優化

  1. 設置按鈕位置調整到右上角
  2. 指紋解鎖在開啟後顯示
  3. 修復iOS10,iPhone6閃退問題
  4. 表頭內容顯示優化

2018-05-14 V1.4.2​ 更新日誌

新增

  1. 支持將當前設備加入測試白名單,用於測試新增數據
  2. 可以按照日,週,月查看活躍數據
  3. 增加頂部公告

優化

  1. 全面優化結構,提高App響應速度
  2. 概覽支持右滑返回上一級界面
  3. 圖表支持長按查看數據
  4. 已標記項目按照收入排序

2017-12-22 V1.3.0 更新日誌

新增

  1. 遊戲支持置頂,讓妳更快的找到常用遊戲
  2. 來源中支持按照累計付費、首日付費、付費次數進行數據篩選
  3. 可以在設置中提交問題和建議

優化

  1. 遊戲列表按照收入排序
  2. 界面佈局優化
  3. 修復了過濾條件內搜索不全的錯誤
  4. 顯示貨幣支持越南盾

2017-11-15 V1.1.0 更新日誌

優化

  1. 適配iPhoneX

2017-10-20 V1.0.0 更新日誌

新增

  1. 支持在概覽頁以及活躍下查看實時在線數據
  2. 可按照不同的貨幣類型查看收入數據

2018-08-03 更新日誌

新功能

  1. 新增原始付費數據導出,可以在工具-數據導出中下載

修復

  1. 過濾條件在部分場景下的搜索排序問題
  2. 外部成員中復制鏈接的flash提示問題
  3. 收起側邊欄時的圖表渲染問題

2018-07-27 更新日志

新功能

  1. 新版報表中心,下載同時可以進入其它頁面看數據,未來將支持更多原始數據導出
  2. 新增特殊用戶歸類,可以將內部用戶、刷榜用戶、特殊用戶標記為特殊廣告渠道,方便查詢和過濾
  3. 廣點通支持授權模式
  4. 概覽支持按日、週、月查詢數據
  5. 廣告默認查詢有數據的廣告,提高響應速度
  6. 廣告增加硬件平台篩選

修復

  1. LTV指標優化,更精準地描述指標定義
  2. 修復部分場景下選擇一日,沒有顯示小時的問題
  3. 搜索優先出精確匹配的結果
  4. 廣告下使用設備、賬號相關的過濾條件(如機型、地區)時,不展現點擊信息,避免誤解

2018-06-08 更新日志

新功能

  1. 首頁遊戲列表支持選擇對比日期

  2. 付費支持按照商品查詢數據 图片描述

  3. 官網全面更新

修復

  1. 部分場景下,總計顯示亂碼的問題
  2. 部分場景下,圖表沒有渲染的問題

2018-05-18 更新日誌

新功能

  1. 用戶價值(LTV) 支持查看第2、4、5、6日的數據
  2. TapDB開始支持多種語言了,目前支持 簡體中文繁體中文英語 ,即將支持 韓語日語 設備白名單
  3. 設備白名單 ,如果需要測試新的分包渠道,新的廣告是否調通,可以將設備加入白名單,這樣可以在一台設備上反複測試不同渠道。

圖片描述

修復

  1. 廣告中的作弊主維度下,修復了存疑廣告會將自己計算在內的問題

2018-05-04 更新日誌

新功能

  1. 防作弊基礎版 ,提供3種基礎防作弊規則:點擊IP離散作弊、激活IP離散作弊、點擊激活時長作弊。

  2. 支持2個新的廣告平臺: 陌陌百度信息流ocpc

  3. 支付渠道 查詢收入 圖片描述

  4. 隱藏渠道 ,可以將不常用、測試、傳遞錯誤的渠道歸類到隱藏渠道 圖片描述

修復

1.概覽下的新增設備未顯示運營事件


廣告概覽

更新日期 2018-04-12

廣告概覽可以幫助你

  • 監控今日的點擊、新增、轉化是否正常

Alt text

  • 瞭解今日投放量Top10的廣告平臺

Alt text

  • 分析近30日的新用戶獲取趨勢、支出和費用趨勢

Alt text


導出細分數據

更新日期 2018-01-11

廣告監測支持導出廣告平臺、廣告、標籤的細分數據,導出後方便查看每個廣告下每天的數據

Alt text


小時活躍、周活躍和月活躍

更新日期 2017-12-15

1.現在可以查看不同日期粒度下的活躍了:

  • 小時活躍(HAU):日期選擇某一天
  • 日活躍(DAU):日期選擇某一段時間
  • 自然周活躍(WAU):活躍頁面下切換到“周活躍”
  • 自然月活躍(MAU):活躍頁面下切換到“月活躍”

其中周活躍、月活躍可以細分不同的分包渠道來查看渠道活躍明細。

Alt text

2.概覽中增加月活躍曲線(MAU) Alt text


選擇時區

更新日期 2017-12-06

創建項目的時候可以選擇不同的時區,方便不同地區發行的遊戲更好的分析數據

Alt text


顯示貨幣

更新日期 2017-10-13

現在可以按照不同的貨幣類型來查看收入數據了

Alt text


數據導出

更新日期 2017-07-20

在工具中使用,可以根據廣告平臺或廣告標籤導出新增用戶的具體信息,比如新增帳號,IDFA等

Alt text


操作日誌

更新日期 2017-07-13

可在企業設置裏查看操作日誌,目前已上線項目、權限、廣告三種日誌類型,方便您更加快捷地瞭解項目狀態、人員及權限變化、廣告投放等情況。

Alt text


實時在線

更新日期 2017-07-12

“實時在線“功能可幫你進行實時在線分析,通過分鐘級在線量展現實時現數據動態。 您可在 【工具-拓展功能】【在線分析】 中自主開啓並使用了。

Alt text


180/360日LTV

更新日期 2017-07-07

運營和廣告下增加180/360日LTV

  • 運營統計中可在付費-用戶價值中查看
  • 廣告監測中可在自定義列中添加並查看

對比日期

更新日期 2017-06-02

對比日期,在運營和廣告模塊增加對比日期功能,可以對不同時間段的數據進行對比,在圖和表中均可查看對比數據的詳情

Alt text


現在可以釘住常用的對比日了

更新日期 2017-05-25

在選擇遊戲概覽中的對比日期時,新增了歷史日記錄功能,最多記錄您最近5次選擇的日期,您可以釘住其中常用的日期,併爲之特殊命名,釘住的日期將一直保存,方便您下次使用。

Alt text


爲渠道命名

更新日期 2017-04-16

可以對分包渠道的名稱進行備註,在工具欄裏可以使用

Alt text


存疑新增

更新日期 2017-04-16

廣告頁面增加存疑新增功能,標記了匹配了多個廣告新增設備

測試設備白名單

當你需要用舊設備測試分包渠道或廣告是否調通時,可以使用測試設備白名單功能來完成這個任務。

一、確保你的遊戲已經接入了最新的SDK

白名單功能需要接入最新的TapDB SDK,具體版本號如下:

iOS:v1.9.2

Android:v1.9.2

Cocos2d-x:v1.3.2

Unity 3D:v1.4.2

下載SDK


二、添加測試設備

你可以使用2種方法添加測試設備:掃碼添加、手動添加

方法一:掃碼添加

1.下載TapDB移動客戶端

圖片描述

2.打開App

未登錄:在登錄界面左上角點擊"!"進入添加頁面

已登錄:點擊左上角“設置”-“測試設備”進入添加頁面

圖片描述

3.點擊添加設備,掃描Web端“企業設置”-“測試設備”-“+添加設備”中的二維碼

圖片描述


方法二:手動添加

  1. 用Web端點擊右上角菜單中的“企業設置”-“測試設備”-“+添加設備”
  2. 選擇“自定義添加”
  3. 選擇系統

圖片描述

4.iOS填寫IDFA

如何獲取IDFA

  1. 下載TapDB客戶端,點擊測試設備,獲取IDFA

5.Android填寫Android ID或Google ID

如何獲取Android ID或Google ID?

  1. 下載TapDB客戶端,點擊測試設備,獲取Android ID和Google ID
  2. 獲取Android ID:打開手機撥號鍵,輸入*#*#8255#*#*
  3. 獲取Google Advertising ID : https://support.google.com/googleplay/android-developer/answer/6048248?hl=en

注意事項:

  1. 每個企業支持添加30個設備。
  2. 不建議添加模擬器設備,部分品牌的模擬器添加後,會導致所有使用該模擬器的設備都會被加入白名單。
  3. 設備加入白名單後,將對該企業下的所有項目生效。
  4. 設備從白名單內移除後,後續數據將傳遞在首次激活的設備號上。

如果需要幫助,請聯繫我們的技術支持 QQ:3171097571 郵件:support@tapdb.com

1.簡介

1.1.適用範圍

TapDB提供一套SDK,遊戲開發者可以將其集成到遊戲中,系統會收集玩家數據,並進行分析,最終形成數據報表,幫助遊戲開發者分析玩家行爲並優化遊戲。

目前SDK適用於Android 2.2及以上的系統。

1.2.名詞解釋

名詞含義
玩家對應一個玩家賬戶,需要一個唯一的標識符。玩家是統計系統的數據統計基本單位
設備安裝了對應遊戲的設備
付費玩家使用真實貨幣換取遊戲虛擬幣或遊戲道具
分包渠道標識遊戲安裝包渠道來源,需要在代碼中設置

2.接入方式

2.1.申請應用

在TapDB控制檯中註冊一個遊戲,獲得遊戲對應的APP ID,這是一個16位的字符串,iOS和Android可共用一個APP ID。

2.2.向工程中導入SDK

在TapDB網站上下載最新的SDK,其中包含一個庫文件libTyrantdbGameTracker.jar,將該庫文件加入到項目的引用庫中。

2.3.添加Android支持庫

添加Android v4支持庫到項目中,Android v4支持庫的版本必須不低於23.0.0,否則可能導致閃退。

如果使用gradle依賴安裝版本高於24.2.0版本的v4支持庫,可以僅安裝support-compat模塊,參見文檔: https://developer.android.com/topic/libraries/support-library/setup.htmlhttps://developer.android.com/topic/libraries/support-library/features.html

如果不方便使用gradle進行自動化依賴安裝,之前也沒有使用到v4支持庫,可以使用此處提供的support-compat模塊的jar文件, https://static.tapdb.net/web/res/file/upload/2017/0926/android-support-v4.jar

2.4.添加需要的權限

需要爲工程中的AndroidManifest.xml添加下列權限。當AndroidManifest.xml中配置的targetSdkVersion大於等於23,同時在初始化函數中設置requestPermission爲true,並且運行在Android 6以上的設備時,TapDB SDK會主動提示用戶進行可選權限授權。

權限是否必須用途
android.permission.INTERNET必選使用網絡的權限
android.permission.ACCESS_NETWORK_STATE必選獲取手機網絡連接狀態
android.permission.WRITE_EXTERNAL_STORAGE可選使用SD卡輔助存儲設備標識等信息,若不具備此權限,有一部分設備無法進行很好的設備跟蹤

2.5.調用統計接口

在需要調用統計接口的代碼中引入類com.xindong.tyrantdb.TyrantdbGameTracker,並按照後面的接口介紹調用統計接口。

3.接口說明

libTyrantdbGameTracker.jar中包含了TyrantdbGameTracker類,並且TyrantdbGameTracker類中還定義了TGTUserType/TGTUserSex兩個枚舉類型。TyrantdbGameTracker包含的都是靜態方法,直接用類名調用即可。TGTUserType表示玩家類型,TGTUserSex表示玩家性別。

3.1.初始化

初始化統計系統SDK,調用這個接口是使用其它接口的先決條件,需要儘早調用。一般建議在MainActivity的OnCreate中調用。

public static void init(Activity activity, String appId, String channel, String version, boolean requestPermission)
字段可爲空說明
activity當前應用的Activity對象,一般傳入MainActivity對象
appId註冊遊戲時獲得的APP ID
channel分包渠道,1.2.名詞解釋中有介紹
version遊戲版本,爲空時,自動獲取遊戲安裝包的版本(AndroidManifest.xml中的versionName)
requestPermission是否由TapDB SDK來申請上述可選權限。當AndroidManifest.xml中配置的targetSdkVersion大於等於23,同時該參數爲true,並且運行在Android 6以上的設備時,TapDB SDK會主動申請APP申明的上述可選權限。

3.2.處理用戶授權回調

爲主activity實現android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback接口,實現其中的onRequestPermissionsResult方法,並且直接在方法中調用TapDB的onRequestPermissionsResult方法並傳遞收到的參數即可,若IDE報錯,可以使用@SuppressLint("Override")忽略報錯。

如果已經實現了該方法,在方法的最後加入調用TapDB的onRequestPermissionsResult方法並傳遞收到的參數即可。

需要注意,實現OnRequestPermissionsResultCallback接口的activity必須和傳遞給TapDB init方法中的activity是同一個。

當AndroidManifest.xml中定義的targetSdkVersion大於等於23,且初始化函數中設置requestPermission爲true時,必須做此處理。建議無論什麼場景都加上,防止以後更改時遺忘。

// 注意一定要爲當前類實現android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback接口,而不是單純加一個方法
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    TyrantdbGameTracker.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

3.3.跟蹤遊戲的啓停

跟蹤玩家遊戲次數和遊戲時長。需要給遊戲中每個Activity的onResume和onStop中添加對應的調用,如果多個Activity繼承同一個父類,只需要在父類中添加調用即可。比如onResume方法,直接在Activity的onResume方法的最後添加TyrantdbGameTracker.onResume(this)即可。

public static void onResume(final Activity activity)
public static void onStop(final Activity activity)
字段可爲空說明
activity當前Activity對象,一般傳入this

3.4.記錄一個玩家

記錄一個玩家(注意是平臺用戶,不是遊戲角色!!!),當玩家登陸時調用,如果是試玩用戶,userId由遊戲自己生成,但需要保證唯一性。

public static void setUser(String userId, TGTUserType userType, TGTUserSex userSex, int userAge, String userName)
字段可爲空說明
userId玩家ID(注意是平臺用戶ID,不是遊戲角色ID!!!),不同玩家要是唯一的,不同用戶平臺可能存在相同的用戶ID,需要想辦法做區分
userType玩家類型,見類型詳細定義
userSex玩家性別,見類型詳細定義
userAge玩家年齡,無法獲知玩家年齡直接傳遞0
userName玩家名稱

3.5.玩家等級

設置玩家等級,玩家登陸時或升級時調用。

public static void setLevel(int level)
字段可爲空說明
level玩家等級

3.6.玩家區服

設置玩家區服,玩家登陸時或更換區服時調用。

public static void setServer(String server)
字段可爲空說明
server玩家服務器

3.7.發起充值請求

(推薦使用服務端充值統計接口)

當玩家發起充值請求時調用。

提醒:由於客戶端行爲,不可避免會有投機者嘗試破解充值; 如果沒有通過服務器校驗,一定會造成數據不準確,強烈建議使用服務器接口進行充值數據回調。 (4.1.充值統計接口)

public static void onChargeRequest(String orderId, String product, long amount, String currencyType, long virtualCurrencyAmount, String payment)
字段可爲空說明
orderId訂單ID
product產品名稱
amount充值金額(單位分,即無論什麼幣種,都需要乘以100)
currencyType貨幣類型,參考:人民幣 CNY,美元 USD;歐元 EUR
virtualCurrencyAmount充值獲得的虛擬幣
payment支付方式,如:支付寶

3.8.充值成功

充值成功時調用,需要與充值請求成對調用

public static void onChargeSuccess(String orderId)
字段可爲空說明
orderId訂單ID,與之前調用的充值請求傳遞的ID對應

3.9.充值失敗

充值失敗時調用,需要與充值請求成對調用

public static void onChargeFail(String orderId, String reason)
字段可爲空說明
orderId訂單ID,與之前調用的充值請求傳遞的ID對應
reason失敗原因

3.10.僅充值成功

當客戶端無法跟蹤充值請求發起,只能跟蹤到充值成功的事件時,調用該接口記錄充值信息

public static void onChargeOnlySuccess(String orderId, String product, long amount, String currencyType, long virtualCurrencyAmount, String payment)
字段可爲空說明
orderId訂單ID
product產品名稱
amount充值金額(單位分,即無論什麼幣種,都需要乘以100)
currencyType貨幣類型,參考:人民幣 CNY,美元 USD;歐元 EUR
virtualCurrencyAmount充值獲得的虛擬幣
payment支付方式,如:支付寶

4.服務端統計接口

4.1.充值統計接口

由於客戶端接入充值統計可能會不太準確,這裏提供服務端充值統計方法,需要忽略掉SDK中的相關充值統計接口

接口:https://e.tapdb.net/event
內容(注意後面還需要處理一下):
{
    "module": "GameAnalysis", //固定
    "ip": "8.8.8.8", //充值用戶的IP,可選
    "name": "charge", //固定
    "index": "APPID", //APPID注意替換成TapDB的appid
    "identify": "user_id", //user_id,必須和客戶端的setUser接口傳遞的user_id一樣,並且該用戶已經通過SDK接口進行過統計
    "properties": {
        "order_id": "100000", //order_id,可選,若傳遞此參數,需要保證order_id唯一,重複訂單不計入統計
        "amount": 100, //充值金額(單位分,即無論什麼幣種,都需要乘以100),必傳
        "virtual_currency_amount": 100, //獲贈虛擬幣數量,必傳,可爲0
        "currency_type": "CNY", //貨幣類型,可選,不傳或者不是正確的貨幣類型,統一處理成人民幣分
        "product": "item1", //充值包名稱,可選
        "payment": "alipay" //充值途徑,可選
    }
}

假如遊戲的appid爲abcd1234,構建出json字符串後,需要去掉空格和換行符,然後再進行一次urlencode,再把結果作爲post數據發過來
先替換換行符和空格,變成:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount":100,"virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
然後urlencode,變成如下形式,某些版本的urlencode可能會把':'和','進行編碼,不影響實際使用。
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

貨幣類型的格式參考匯率表

成功判斷:返回的HTTP Code爲200認爲發送成功,否則認爲失敗

4.2.在線數據統計接口

由於SDK無法進行準確的在線數據統計,這裏提供服務端在線數據統計接口。遊戲服務端可以每隔5分鐘自行統計在線人數,通過接口發送到TapDB,TapDB進行數據彙總和展現。

接口:https://se.tapdb.net/tapdb/online
方法:POST
格式:json
必須頭信息:Content-Type: application/json

請求內容:

參數名參數類型參數說明
appidstringTapDB的appid
onlinesarray多條在線數據(最多100條)

其中onlines數組的結構爲

參數名參數類型參數說明
serverstring服務器,TapDB對同一服務器每一個自然5分鐘僅接受一次數據
onlineint在線人數
timestamplong當前統計數據的時間戳(秒),TapDB會按照自然5分鐘進行數據對齊

示例:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

成功判斷:返回的HTTP Code爲200認爲發送成功,否則認爲失敗

1.簡介

1.1.適用範圍

封裝了TapDB的SDK,適用於 Cocos2d-x 開發的遊戲,同時支持 iOS 和 Android 平臺。

1.2.名詞解釋

名詞含義
玩家對應一個玩家賬戶,需要一個唯一的標識符。玩家是統計系統的數據統計基本單位
設備安裝了對應遊戲的設備
付費玩家使用真實貨幣換取遊戲虛擬幣或遊戲道具
分包渠道標識遊戲安裝包渠道來源,需要在代碼中設置

2.接入方式

2.1.申請應用

在TapDB控制檯中註冊一個遊戲,獲得遊戲對應的APP ID,這是一個16位的字符串,iOS和Android可共用一個APP ID。

2.2.向工程中導入SDK

在TapDB網站上下載最新的SDK,其中包含一個 TapDB_sdk.zip 文件,解壓得到3個文件夾,include文件夾裏面是頭文件,iOS和Android文件夾裏面是對應平臺的實現代碼和庫文件。另外,在Android.mk裏面添加對TapDB.cpp的引用。

2.3.添加Android支持庫

添加Android v4支持庫到項目中,Android v4支持庫的版本必須不低於23.0.0,否則可能導致閃退。

如果使用gradle依賴安裝版本高於24.2.0版本的v4支持庫,可以僅安裝support-compat模塊,參見文檔: https://developer.android.com/topic/libraries/support-library/setup.htmlhttps://developer.android.com/topic/libraries/support-library/features.html

如果不方便使用gradle進行自動化依賴安裝,之前也沒有使用到v4支持庫,可以使用此處提供的support-compat模塊的jar文件, https://static.tapdb.net/web/res/file/upload/2017/0926/android-support-v4.jar

2.4.Android添加需要的權限

需要爲工程中的AndroidManifest.xml添加下列權限

權限是否必須用途
android.permission.INTERNET必選使用網絡的權限
android.permission.ACCESS_NETWORK_STATE必選獲取手機網絡連接狀態
android.permission.WRITE_EXTERNAL_STORAGE可選使用SD卡輔助存儲設備標識等信息,若不具備此權限,有一部分設備無法進行很好的設備跟蹤

2.5.iOS引入依賴的框架

需要爲Xcode工程引入下列依賴的框架或庫

框架或庫用途
CoreTelephony.framework用來獲取運營商標識
AdSupport.framework用來獲取設備廣告標識,跟蹤設備
Security.framework用來進行更好的持久化存儲

2.6.調用統計接口

在需要調用統計接口的代碼中引入TapDB.h,並按照後面的接口介紹調用統計接口。

3.接口說明

TapDB.h包含了類TapDB,還定義了TGTUserType/TGTUserSex兩個枚舉類型。TapDB包含的都是靜態方法,直接用類名調用即可。TGTUserType表示玩家類型,TGTUserSex表示玩家性別。

3.1.初始化

初始化統計系統SDK,調用這個接口是使用其它接口的先決條件,需要儘早調用。init 方法會初始化 SDK,在此之前不可以調用 SDK 的其他方法。

Android需要引入libTyrantdbGameTracker.jar,並且在主 Activity 的 onCreate() 中調用 TyrantdbGameTracker.init(Activity activity, String appId, String channelId, String version, bool requestPermission),最後一個參數固定傳遞false。

public static void onStart(string appId, string channel, string version)
字段可爲空說明
appId註冊遊戲時獲得的APP ID
channel分包渠道,1.2.名詞解釋中有介紹
version遊戲版本,爲空時,自動獲取遊戲安裝包的版本

3.2.跟蹤遊戲的啓停(只適用於Android)

跟蹤玩家遊戲次數和遊戲時長。需要給遊戲中每個Activity的onResume和onStop中添加對應的調用。如:在MainActivity裏面調用TyrantdbGameTracker.onStop (this);即可。

public static void onResume(Context ctx)
public static void onStop(Context ctx)

3.3.記錄一個玩家

記錄一個玩家(注意是平臺用戶,不是遊戲角色!!!),當玩家登陸時調用,如果是試玩用戶,userId由遊戲自己生成,但需要保證唯一性。

public static void setUser(const char *userId, TGTUserType userType, TGTUserSex userSex,
 int userAge, const char *userName)
字段可爲空說明
userId玩家ID(注意是平臺用戶ID,不是遊戲角色ID!!!),不同玩家要是唯一的,不同用戶平臺可能存在相同的用戶ID,需要想辦法做區分
userType玩家類型,見類型詳細定義
userSex玩家性別,見類型詳細定義
userAge玩家年齡,無法獲知玩家年齡直接傳遞0
userName玩家名稱

3.4.玩家等級

設置玩家等級,玩家登陸時或升級時調用。

public static void setLevel(int level)
字段可爲空說明
level玩家等級

3.5.玩家區服

設置玩家區服,玩家登陸時或更換區服時調用。

public static void setServer(const char *server)
字段可爲空說明
server玩家服務器

3.6.發起充值請求

(推薦使用服務端充值統計接口)

當玩家發起充值請求時調用。

提醒:由於客戶端行爲,不可避免會有投機者嘗試破解充值; 如果沒有通過服務器校驗,一定會造成數據不準確,強烈建議使用服務器接口進行充值數據回調。 (4.1.充值統計接口)

public static void onChargeRequest(const char *orderId, const char *product,
 long amount, const char * currencyType, long virtualCurrencyAmount, const char *payment)
字段可爲空說明
orderId訂單ID
product產品名稱
amount充值金額(單位分,即無論什麼幣種,都需要乘以100)
currencyType貨幣類型,參考:人民幣 CNY,美元 USD;歐元 EUR
virtualCurrencyAmount充值獲得的虛擬幣
payment支付方式,如:支付寶

3.7.充值成功

充值成功時調用,需要與充值請求成對調用

public static void onChargeSuccess(const char *orderId)
字段可爲空說明
orderId訂單ID,與之前調用的充值請求傳遞的ID對應

3.8.充值失敗

充值失敗時調用,需要與充值請求成對調用

public static void onChargeFail(const char *orderId, const char *reason)
字段可爲空說明
orderId訂單ID,與之前調用的充值請求傳遞的ID對應
reason失敗原因

3.9.僅充值成功

當客戶端無法跟蹤充值請求發起,只能跟蹤到充值成功的事件時,調用該接口記錄充值信息

public static void onChargeOnlySuccess(const char *orderId, const char *product,
long amount, const char *currencyType, long virtualCurrencyAmount, const char *payment)
字段可爲空說明
orderId訂單ID
product產品名稱
amount充值金額(單位分,即無論什麼幣種,都需要乘以100)
currencyType貨幣類型,參考:人民幣 CNY,美元 USD;歐元 EUR
virtualCurrencyAmount充值獲得的虛擬幣
payment支付方式,如:支付寶

4.服務端統計接口

4.1.充值統計接口

由於客戶端接入充值統計可能會不太準確,這裏提供服務端充值統計方法,需要忽略掉SDK中的相關充值統計接口

接口:https://e.tapdb.net/event
內容(注意後面還需要處理一下):
{
    "module": "GameAnalysis", //固定
    "ip": "8.8.8.8", //充值用戶的IP,可選
    "name": "charge", //固定
    "index": "APPID", //APPID注意替換成TapDB的appid
    "identify": "user_id", //user_id,必須和客戶端的setUser接口傳遞的user_id一樣,並且該用戶已經通過SDK接口進行過統計
    "properties": {
        "order_id": "100000", //order_id,可選,若傳遞此參數,需要保證order_id唯一,重複訂單不計入統計
        "amount": 100, //充值金額(單位分,即無論什麼幣種,都需要乘以100),必傳
        "virtual_currency_amount": 100, //獲贈虛擬幣數量,必傳,可爲0
        "currency_type": "CNY", //貨幣類型,可選,不傳或者不是正確的貨幣類型,統一處理成人民幣分
        "product": "item1", //充值包名稱,可選
        "payment": "alipay" //充值途徑,可選
    }
}

假如遊戲的appid爲abcd1234,構建出json字符串後,需要去掉空格和換行符,然後再進行一次urlencode,再把結果作爲post數據發過來
先替換換行符和空格,變成:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount":100,"virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
然後urlencode,變成如下形式,某些版本的urlencode可能會把':'和','進行編碼,不影響實際使用。
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

貨幣類型的格式參考匯率表

成功判斷:返回的HTTP Code爲200認爲發送成功,否則認爲失敗

4.2.在線數據統計接口

由於SDK無法進行準確的在線數據統計,這裏提供服務端在線數據統計接口。遊戲服務端可以每隔5分鐘自行統計在線人數,通過接口發送到TapDB,TapDB進行數據彙總和展現。

接口:https://se.tapdb.net/tapdb/online
方法:POST
格式:json
必須頭信息:Content-Type: application/json

請求內容:

參數名參數類型參數說明
appidstringTapDB的appid
onlinesarray多條在線數據(最多100條)

其中onlines數組的結構爲

參數名參數類型參數說明
serverstring服務器,TapDB對同一服務器每一個自然5分鐘僅接受一次數據
onlineint在線人數
timestamplong當前統計數據的時間戳(秒),TapDB會按照自然5分鐘進行數據對齊

示例:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

成功判斷:返回的HTTP Code爲200認爲發送成功,否則認爲失敗

1.簡介

1.1.適用範圍

TapDB提供一套SDK,遊戲開發者可以將其集成到遊戲中,系統會收集玩家數據,並進行分析,最終形成數據報表,幫助遊戲開發者分析玩家行爲並優化遊戲。

目前SDK適用於iOS 5.0及以上的系統,支持armv7/armv7s/arm64架構。

1.2.名詞解釋

名詞含義
玩家對應一個玩家賬戶,需要一個唯一的標識符。玩家是統計系統的數據統計基本單位
設備安裝了對應遊戲的設備
付費玩家使用真實貨幣換取遊戲虛擬幣或遊戲道具
分包渠道標識遊戲安裝包渠道來源,需要在代碼中設置

2.接入方式

2.1.申請應用

在TapDB控制檯中註冊一個遊戲,獲得遊戲對應的APP ID,這是一個16位的字符串,iOS和Android可共用一個APP ID。

2.2.向Xcode工程中導入SDK

在TapDB網站上下載最新的SDK,其中包含一個頭文件TyrantdbGameTracker.h和一個靜態鏈接庫文件libTyrantdbGameTracker.a。將兩個文件導入到Xcode工程中,並確保所有需要用到SDK的Target都鏈接到靜態庫文件。

2.3.引入依賴的框架

需要爲Xcode工程引入下列依賴的框架或庫

框架或庫用途
CoreTelephony.framework用來獲取運營商標識
AdSupport.framework用來獲取設備廣告標識,跟蹤設備
Security.framework用來進行更好的持久化存儲

2.4.調用統計接口

在需要調用統計接口的代碼中引入頭文件TyrantdbGameTracker.h,並按照後面的接口介紹調用統計接口。

3.接口說明

頭文件中定義了一個TyrantdbGameTracker類和TGTUserType/TGTUserSex兩個枚舉類型。TyrantdbGameTracker包含的都是靜態方法,直接用類名調用即可。TGTUserType表示玩家類型,TGTUserSex表示玩家性別。

3.1.初始化

初始化統計系統SDK,調用這個接口是使用其它接口的先決條件,需要儘早調用。一般建議在AppDelegate的application:didFinishLaunchingWithOptions:中調用。

+ (void)onStart:(NSString *)appId channel:(NSString *)channel version:(NSString *)version;
字段可爲空說明
appId註冊遊戲時獲得的APP ID
channel分包渠道,1.2.名詞解釋中有介紹
version遊戲版本,爲空時,自動獲取遊戲安裝包的版本(Xcode配置中的Version)

3.2.記錄一個玩家

記錄一個玩家(注意是平臺用戶,不是遊戲角色!!!),當玩家登陸時調用,如果是試玩用戶,userId由遊戲自己生成,但需要保證唯一性。

+ (void)setUser:(NSString *)userId userType:(TGTUserType)userType userSex:(TGTUserSex)userSex userAge:(NSInteger)userAge userName:(NSString *)userName;
字段可爲空說明
userId玩家ID(注意是平臺用戶ID,不是遊戲角色ID!!!),不同玩家要是唯一的,不同用戶平臺可能存在相同的用戶ID,需要想辦法做區分
userType玩家類型,見類型詳細定義
userSex玩家性別,見類型詳細定義
userAge玩家年齡,無法獲知玩家年齡直接傳遞0
userName玩家名稱

3.3.玩家等級

設置玩家等級,玩家登陸時或升級時調用。

+ (void)setLevel:(NSInteger)level;
字段可爲空說明
level玩家等級

3.4.玩家區服

設置玩家區服,玩家登陸時或更換區服時調用。

+ (void)setServer:(NSString *)server;
字段可爲空說明
server玩家服務器

3.5.發起充值請求

(推薦使用服務端充值統計接口)

當玩家發起充值請求時調用。

提醒:由於客戶端行爲,不可避免會有投機者嘗試破解充值; 如果沒有通過服務器校驗,一定會造成數據不準確,強烈建議使用服務器接口進行充值數據回調。 (4.1.充值統計接口)

+ (void)onChargeRequest:(NSString *)orderId product:(NSString *)product amount:(NSInteger)amount currencyType:(NSString *)currencyType virtualCurrencyAmount:(NSInteger)virtualCurrencyAmount payment:(NSString *)payment;
字段可爲空說明
orderId訂單ID
product產品名稱
amount充值金額(單位分,即無論什麼幣種,都需要乘以100)
currencyType貨幣類型,參考:人民幣 CNY,美元 USD;歐元 EUR
virtualCurrencyAmount充值獲得的虛擬幣
payment支付方式,如:支付寶

3.6.充值成功

充值成功時調用,需要與充值請求成對調用

+ (void)onChargeSuccess:(NSString *)orderId;
字段可爲空說明
orderId訂單ID,與之前調用的充值請求傳遞的ID對應

3.7.充值失敗

充值失敗時調用,需要與充值請求成對調用

+ (void)onChargeFail:(NSString *)orderId reason:(NSString *)reason;
字段可爲空說明
orderId訂單ID,與之前調用的充值請求傳遞的ID對應
reason失敗原因

3.8.僅充值成功

當客戶端無法跟蹤充值請求發起,只能跟蹤到充值成功的事件時,調用該接口記錄充值信息

+ (void)onChargeOnlySuccess:(NSString *)orderId product:(NSString *)product amount:(NSInteger)amount currencyType:(NSString *)currencyType virtualCurrencyAmount:(NSInteger)virtualCurrencyAmount payment:(NSString *)payment;
字段可爲空說明
orderId訂單ID
product產品名稱
amount充值金額(單位分,即無論什麼幣種,都需要乘以100)
currencyType貨幣類型,參考:人民幣 CNY,美元 USD;歐元 EUR
virtualCurrencyAmount充值獲得的虛擬幣
payment支付方式,如:支付寶

4.服務端統計接口

4.1.充值統計接口

由於客戶端接入充值統計可能會不太準確,這裏提供服務端充值統計方法,需要忽略掉SDK中的相關充值統計接口

接口:https://e.tapdb.net/event
內容(注意後面還需要處理一下):
{
    "module": "GameAnalysis", //固定
    "ip": "8.8.8.8", //充值用戶的IP,可選
    "name": "charge", //固定
    "index": "APPID", //APPID注意替換成TapDB的appid
    "identify": "user_id", //user_id,必須和客戶端的setUser接口傳遞的user_id一樣,並且該用戶已經通過SDK接口進行過統計
    "properties": {
        "order_id": "100000", //order_id,可選,若傳遞此參數,需要保證order_id唯一,重複訂單不計入統計
        "amount": 100, //充值金額(單位分,即無論什麼幣種,都需要乘以100),必傳
        "virtual_currency_amount": 100, //獲贈虛擬幣數量,必傳,可爲0
        "currency_type": "CNY", //貨幣類型,可選,不傳或者不是正確的貨幣類型,統一處理成人民幣分
        "product": "item1", //充值包名稱,可選
        "payment": "alipay" //充值途徑,可選
    }
}

假如遊戲的appid爲abcd1234,構建出json字符串後,需要去掉空格和換行符,然後再進行一次urlencode,再把結果作爲post數據發過來
先替換換行符和空格,變成:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount":100,"virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
然後urlencode,變成如下形式,某些版本的urlencode可能會把':'和','進行編碼,不影響實際使用。
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

貨幣類型的格式參考匯率表

成功判斷:返回的HTTP Code爲200認爲發送成功,否則認爲失敗

4.2.在線數據統計接口

由於SDK無法進行準確的在線數據統計,這裏提供服務端在線數據統計接口。遊戲服務端可以每隔5分鐘自行統計在線人數,通過接口發送到TapDB,TapDB進行數據彙總和展現。

接口:https://se.tapdb.net/tapdb/online
方法:POST
格式:json
必須頭信息:Content-Type: application/json

請求內容:

參數名參數類型參數說明
appidstringTapDB的appid
onlinesarray多條在線數據(最多100條)

其中onlines數組的結構爲

參數名參數類型參數說明
serverstring服務器,TapDB對同一服務器每一個自然5分鐘僅接受一次數據
onlineint在線人數
timestamplong當前統計數據的時間戳(秒),TapDB會按照自然5分鐘進行數據對齊

示例:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

成功判斷:返回的HTTP Code爲200認爲發送成功,否則認爲失敗

接入文檔

對接SDK的開發者請仔細閱讀

1.目前支持iOS、Android、U3D、cocos的SDK及文檔方便開發者選擇

2.已傳遞的數據不可修改,請正確傳遞渠道,玩家,收入等相關數據,以便後續的數據分析

3.充值和玩家在線數據提供服務端傳遞方式,讓數據更加準確

4.接入時遇到任何問題,可以聯繫技術支持QQ: 3485772949

SDK文檔

1.簡介

1.1.適用範圍

TapDB提供一套SDK,遊戲開發者可以將其集成到遊戲中,系統會收集玩家數據,並進行分析,最終形成數據報表,幫助遊戲開發者分析玩家行爲並優化遊戲。

適用於Unity開發的遊戲,Android支持2.2及以上的系統,iOS支持5.0及以上的系統。

1.2.名詞解釋

名詞含義
玩家對應一個玩家賬戶,需要一個唯一的標識符。玩家是統計系統的數據統計基本單位
設備安裝了對應遊戲的設備
付費玩家使用真實貨幣換取遊戲虛擬幣或遊戲道具
分包渠道標識遊戲安裝包渠道來源,需要在代碼中設置

2.接入方式

2.1.申請應用

在TapDB控制檯中註冊一個遊戲,獲得遊戲對應的APP ID,這是一個16位的字符串,iOS和Android可共用一個APP ID。

2.2.向工程中導入SDK

在TapDB網站上下載最新的SDK,其中包含一個 TapDB.unitypackage 文件,在 Unity3D 編譯器中選擇 Assets --> Import Package --> Custom Package 找到 TapDB.unitypackage 文件,點擊"打開按鈕"即可導入成功。其中demo.cs僅是示例代碼,不是SDK所需的代碼。

2.3.添加Android支持庫

添加Android v4支持庫到項目中,Android v4支持庫的版本必須不低於23.0.0,否則可能導致閃退。

如果使用gradle依賴安裝版本高於24.2.0版本的v4支持庫,可以僅安裝support-compat模塊,參見文檔: https://developer.android.com/topic/libraries/support-library/setup.htmlhttps://developer.android.com/topic/libraries/support-library/features.html

如果不方便使用gradle進行自動化依賴安裝,之前也沒有使用到v4支持庫,可以使用此處提供的support-compat模塊的jar文件, https://static.tapdb.net/web/res/file/upload/2017/0926/android-support-v4.jar

2.4.Android添加需要的權限

需要爲工程中的AndroidManifest.xml添加下列權限。當AndroidManifest.xml中配置的targetSdkVersion大於等於23,同時在初始化函數中設置requestPermission爲true,並且運行在Android 6以上的設備時,TapDB SDK會主動提示用戶進行可選權限授權。

權限是否必須用途
android.permission.INTERNET必選使用網絡的權限
android.permission.ACCESS_NETWORK_STATE必選獲取手機網絡連接狀態
android.permission.WRITE_EXTERNAL_STORAGE可選使用SD卡輔助存儲設備標識等信息,若不具備此權限,有一部分設備無法進行很好的設備跟蹤

2.5.iOS引入依賴的框架

需要爲iOS導出的Xcode工程引入下列依賴的框架或庫

框架或庫用途
CoreTelephony.framework用來獲取運營商標識
AdSupport.framework用來獲取設備廣告標識,跟蹤設備
Security.framework用來進行更好的持久化存儲

2.6.調用統計接口

在需要調用統計接口的代碼中引入類TapDB,並按照後面的接口介紹調用統計接口。

3.接口說明

TapDB類中定義了TGTUserType/TGTUserSex兩個枚舉類型。TapDB包含的都是靜態方法,直接用類名調用即可。TGTUserType表示玩家類型,TGTUserSex表示玩家性別。

3.1.初始化

初始化統計系統SDK,調用這個接口是使用其它接口的先決條件,需要儘早調用。一般建議在Unity裏的Start()裏面調用。

public static void onStart(string appId, string channel, string gameVersion, bool requestPermission)
字段可爲空說明
appId註冊遊戲時獲得的APP ID
channel分包渠道,1.2.名詞解釋中有介紹
gameVersion遊戲版本,爲空時,自動獲取遊戲安裝包的版本(Android是AndroidManifest.xml中的versionName,iOS是Xcode配置中的Version)
requestPermission在Android上是否由TapDB SDK來申請上述可選權限。當AndroidManifest.xml中配置的targetSdkVersion大於等於23,同時該參數爲true,並且運行在Android 6以上的設備時,TapDB SDK會主動申請APP申明的上述可選權限。

3.2.Android處理用戶授權回調

爲主activity實現android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback接口,實現其中的onRequestPermissionsResult方法,並且直接在方法中調用TapDB的onRequestPermissionsResult方法並傳遞收到的參數即可,若IDE報錯,可以使用@SuppressLint("Override")忽略報錯。

如果已經實現了該方法,在方法的最後加入調用代碼即可。

主activity一般是繼承com.unity3d.player.UnityPlayerActivity的子類,並且需要在AndroidManifest.xml中指定爲主activity。

當AndroidManifest.xml中定義的targetSdkVersion大於等於23,且初始化函數中設置requestPermission爲true時,必須做此處理。建議無論什麼場景都加上,防止以後更改時遺忘。

// 注意一定要爲當前類實現android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback接口,而不是單純加一個方法
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    try {
        Class<?> clazz = Class.forName("com.xindong.tyrantdb.TyrantdbGameTracker");
        Method method = clazz.getMethod("onRequestPermissionsResult", int.class, String[].class, int[].class);
        method.invoke(null, requestCode, permissions, grantResults);
    } catch (ClassNotFoundException e) {
    } catch (NoSuchMethodException e) {
    } catch (IllegalAccessException e) {
    } catch (IllegalArgumentException e) {
    } catch (InvocationTargetException e) {
    }
}

由於代碼中用到了反射調用,混淆代碼時,請不要對com.xindong.tyrantdb.TyrantdbGameTracker進行混淆

3.3.跟蹤遊戲的啓停

跟蹤玩家遊戲次數和遊戲時長。可參照SDK demo中的方式進行調用。

public static void onResume()
public static void onStop()

3.4.記錄一個玩家

記錄一個玩家(注意是平臺用戶,不是遊戲角色!!!),當玩家登陸時調用,如果是試玩用戶,userId由遊戲自己生成,但需要保證唯一性。

public static void setUser(string userId, TGTUserType userType, TGTUserSex userSex, int userAge, string userName)
字段可爲空說明
userId玩家ID(注意是平臺用戶ID,不是遊戲角色ID!!!),不同玩家要是唯一的,不同用戶平臺可能存在相同的用戶ID,需要想辦法做區分
userType玩家類型,見類型詳細定義
userSex玩家性別,見類型詳細定義
userAge玩家年齡,無法獲知玩家年齡直接傳遞0
userName玩家名稱

3.5.玩家等級

設置玩家等級,玩家登陸時或升級時調用。

public static void setLevel(int level)
字段可爲空說明
level玩家等級

3.6.玩家區服

設置玩家區服,玩家登陸時或更換區服時調用。

public static void setServer(string server)
字段可爲空說明
server玩家服務器

3.7.發起充值請求

(推薦使用服務端充值統計接口)

當玩家發起充值請求時調用。

提醒:由於客戶端行爲,不可避免會有投機者嘗試破解充值; 如果沒有通過服務器校驗,一定會造成數據不準確,強烈建議使用服務器接口進行充值數據回調。 (4.1.充值統計接口)

public static void onChargeRequest(string orderId, string product, Int32 amount, string currencyType, Int32 virtualCurrencyAmount, string payment)
字段可爲空說明
orderId訂單ID
product產品名稱
amount充值金額(單位分,即無論什麼幣種,都需要乘以100)
currencyType貨幣類型,參考:人民幣 CNY,美元 USD;歐元 EUR
virtualCurrencyAmount充值獲得的虛擬幣
payment支付方式,如:支付寶

3.8.充值成功

充值成功時調用,需要與充值請求成對調用

public static void onChargeSuccess(string orderId)
字段可爲空說明
orderId訂單ID,與之前調用的充值請求傳遞的ID對應

3.9.充值失敗

充值失敗時調用,需要與充值請求成對調用

public static void onChargeFail(string orderId, string reason)
字段可爲空說明
orderId訂單ID,與之前調用的充值請求傳遞的ID對應
reason失敗原因

3.10.僅充值成功

當客戶端無法跟蹤充值請求發起,只能跟蹤到充值成功的事件時,調用該接口記錄充值信息

public static void onChargeOnlySuccess(string orderId, string product, Int32 amount, string currencyType, Int32 virtualCurrencyAmount, string payment)
字段可爲空說明
orderId訂單ID
product產品名稱
amount充值金額(單位分,即無論什麼幣種,都需要乘以100)
currencyType貨幣類型,參考:人民幣 CNY,美元 USD;歐元 EUR
virtualCurrencyAmount充值獲得的虛擬幣
payment支付方式,如:支付寶

4.服務端統計接口

4.1.充值統計接口

由於客戶端接入充值統計可能會不太準確,這裏提供服務端充值統計方法,需要忽略掉SDK中的相關充值統計接口

接口:https://e.tapdb.net/event
內容(注意後面還需要處理一下):
{
    "module": "GameAnalysis", //固定
    "ip": "8.8.8.8", //充值用戶的IP,可選
    "name": "charge", //固定
    "index": "APPID", //APPID注意替換成TapDB的appid
    "identify": "user_id", //user_id,必須和客戶端的setUser接口傳遞的user_id一樣,並且該用戶已經通過SDK接口進行過統計
    "properties": {
        "order_id": "100000", //order_id,可選,若傳遞此參數,需要保證order_id唯一,重複訂單不計入統計
        "amount": 100, //充值金額(單位分,即無論什麼幣種,都需要乘以100),必傳
        "virtual_currency_amount": 100, //獲贈虛擬幣數量,必傳,可爲0
        "currency_type": "CNY", //貨幣類型,可選,不傳或者不是正確的貨幣類型,統一處理成人民幣分
        "product": "item1", //充值包名稱,可選
        "payment": "alipay" //充值途徑,可選
    }
}

假如遊戲的appid爲abcd1234,構建出json字符串後,需要去掉空格和換行符,然後再進行一次urlencode,再把結果作爲post數據發過來
先替換換行符和空格,變成:
{"module":"GameAnalysis","name":"charge","index":"abcd1234","identify":"user_id","properties":{"order_id":"100000","amount":100,"virtual_currency_amount":100,"currency_type":"CNY","product":"item1","payment":"alipay"}}
然後urlencode,變成如下形式,某些版本的urlencode可能會把':'和','進行編碼,不影響實際使用。
%7B%22module%22:%22GameAnalysis%22,%22name%22:%22charge%22,%22index%22:%22abcd1234%22,%22identify%22:%22user_id%22,%22properties%22:%7B%22order_id%22:%22100000%22,%22amount%22:100,%22virtual_currency_amount%22:100,%22currency_type%22:%22CNY%22,%22product%22:%22item1%22,%22payment%22:%22alipay%22%7D%7D

貨幣類型的格式參考匯率表

成功判斷:返回的HTTP Code爲200認爲發送成功,否則認爲失敗

4.2.在線數據統計接口

由於SDK無法進行準確的在線數據統計,這裏提供服務端在線數據統計接口。遊戲服務端可以每隔5分鐘自行統計在線人數,通過接口發送到TapDB,TapDB進行數據彙總和展現。

接口:https://se.tapdb.net/tapdb/online
方法:POST
格式:json
必須頭信息:Content-Type: application/json

請求內容:

參數名參數類型參數說明
appidstringTapDB的appid
onlinesarray多條在線數據(最多100條)

其中onlines數組的結構爲

參數名參數類型參數說明
serverstring服務器,TapDB對同一服務器每一個自然5分鐘僅接受一次數據
onlineint在線人數
timestamplong當前統計數據的時間戳(秒),TapDB會按照自然5分鐘進行數據對齊

示例:

{
  "appid":"gkjasd13bbsa1sdk",
  "onlines":[{
    "server":"s1",
    "online":123,
    "timestamp":1489739590
  },{
    "server":"s2",
    "online":188,
    "timestamp":1489739560
  }]
}

成功判斷:返回的HTTP Code爲200認爲發送成功,否則認爲失敗