### Real Monitoring URL Examples (Transformed) Source: https://datanexus.qq.com/doc/develop/guider/interface/conversion/ad_track_wechat_shop Actual monitoring URL examples showing how macro parameters are replaced with real values. Includes examples for both conversion rule binding and direct ad binding scenarios, demonstrating URL-encoded callback parameters. ```url https://www.example.com/click/?adgroup_id=228691429&callback=http%3A%2F%2Fapi.e.qq.com%2Fconv%3Fcb%3DMTIzYWJjNDU2ZGVm%26conv_id%3D12345678 ``` ```url https://www.example.com/click/?adgroup_id=228691429&callback=http%3A%2F%2Fapi.e.qq.com%2Fconv%3Fcb%3DMTIzYWJjNDU2ZGVm ``` -------------------------------- ### Install and import Tencent Ads Mini Program SDK Source: https://datanexus.qq.com/doc/develop/guider/sdk/miniprogram/init Install the SDK via npm and import it into your project. Use the npm package for standard projects or import the local build file when using the downloaded zip. No additional dependencies are required. ```bash npm i @dn-sdk/miniprogram ``` ```javascript import { SDK } from '@dn-sdk/miniprogram'; ``` ```javascript import { SDK } from './lib/dn-sdk-miniprogram/index.js'; ``` -------------------------------- ### SDK start Method Source: https://datanexus.qq.com/doc/develop/guider/sdk/harmony/init Starts the SDK after initialization. This allows the SDK to begin collecting and reporting personal information, improving attribution success rates. ```APIDOC ## start ### Description Starts the SDK operations, enabling data collection and reporting. Should be called immediately after init to optimize device ID filling and attribution. ### Method start ### Parameters #### Request Body - No parameters required. ### Request Example {} ### Response #### Success Response (SDK started) - No specific response data; enables data acquisition. #### Response Example {} ``` -------------------------------- ### Initialize Tencent Ads SDK in Mini Program (Native, Taro, mpvue) Source: https://datanexus.qq.com/doc/develop/guider/sdk/miniprogram/init Create an SDK instance with required configuration such as user_action_set_id, secret_key, and appid. Set optional identifiers like openid or unionid and enable auto tracking. Examples are provided for native Mini Program, Taro framework, and mpvue framework. ```javascript import { SDK } from '@dn-sdk/miniprogram/build/index.js'; // import { SDK } from './lib/dn-sdk-miniprogram/index.js'; // 是否打开调试模式, 建议仅在调试期间开启 SDK.setDebug(true); const sdk = new SDK({ // 数据源ID,必填 user_action_set_id: 'your_user_action_set_id', // 加密key,必填 secret_key: 'your_secret_key', // 微信小程序APPID,wx开头,必填 appid: 'wx123xyz123xyz123x', // 微信 openid,openid 和 unionid 只能填一个(优先填写openid), 可以调用 setOpenId 设置 openid: 'user_openid', // 微信 unionid,openid 和 unionid 只能填一个(优先填写openid), 可以调用 setUnionId 设置 unionid: 'user_unionid', // 自定义用户ID,选填 user_unique_id: 'user_unique_id', // 是否开启自动采集,选填,默认为true auto_track: true, }); // 请先拿到openid/unionid(比如通过调用后端接口的方式)后再设置,后端如何获取openid/unionid请参考微信小程序开放平台://https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html wx.request({ url: '后端获取 openid 的接口', success: function(res){ if(res.openid){ sdk.setOpenId(res.openid); } } }); // 异步获取 unionid 后再设置 wx.request({ url: '后端获取 unionid 的接口', success: function(res){ if(res.unionid){ sdk.setUnionId(res.unionid); } } }); ``` ```typescript import { SDK } from '@dn-sdk/miniprogram/build/index.js'; // import { SDK } from './lib/dn-sdk-miniprogram/index.js'; const App = createApp({ onShow (options) { console.log('App onShow.') }, }); App.use(setGlobalDataPlugin, { DNSDK: new SDK({ // 数据源ID,必填 user_action_set_id: 'your_user_action_set_id', // 加密key,必填 secret_key: 'your_secret_key', // 微信小程序APPID,wx开头,必填 appid: 'wx123xyz123xyz123x', // 微信 openid,openid 和 unionid 只能填一个(优先填写openid), 可以调用 setOpenId 设置 openid: 'user_openid', // 微信 unionid,openid 和 unionid 只能填一个(优先填写openid), 可以调用 setUnionId 设置 unionid: 'user_unionid', // 自定义用户ID,选填 user_unique_id: 'user_unique_id', // 是否开启自动采集,选填,默认为true auto_track: true, }) }); export default App ``` ```javascript import Vue from 'vue' import App from './App' import { SDK } from '@dn-sdk/miniprogram/build/index.js'; // import { SDK } from './lib/dn-sdk-miniprogram/index.js'; Vue.config.productionTip = false App.mpType = 'app' const app = new Vue(App) app.$mount() Vue.prototype.globalData.DNSDK = new SDK({ // 数据源ID,必填 user_action_set_id: 'your_user_action_set_id', // 加密key,必填 secret_key: 'your_secret_key', // 微信小程序APPID,wx开头,必填 appid: 'wx123xyz123xyz123x', // 微信 openid,openid 和 unionid 只能填一个(优先填写openid), 可以调用 setOpenId 设置 openid: 'user_openid', // 微信 unionid,openid 和 unionid 只能填一个(优先填写openid), 可以调用 setUnionId 设置 unionid: 'user_unionid', // 自定义用户ID,选填 user_unique_id: 'user_unique_id', // 是否开启自动采集,选填,默认为true auto_track: true, }); ``` -------------------------------- ### 启动 GDTAction SDK Source: https://datanexus.qq.com/doc/develop/guider/sdk/ios/init 对于 SDK 版本号大于等于 2.1.0 的情况,需要在 App 入口文件的 didFinishLaunchingWithOptions 方法中调用 GDTAction 的 start 方法来启动 SDK。在调用 start 方法之前,必须先调用 init 方法完成 SDK 的初始化。 ```objective-c - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { /* * 请在App启动的时候调用初始化方法 * 方法入参为步骤2获取的数据源ID和密钥 */ [GDTAction init:@"yourActionSetId" secretKey:@"yourSecretKey"]; /* * SDK版本号>=2.1.0才需要调用start方法 * 调用start方法前,请先调用init方法初始化SDK */ [GDTAction start]; return YES; } ``` -------------------------------- ### Configuring Webpack and Initializing DN SDK in Kbone Source: https://datanexus.qq.com/doc/develop/guider/sdk/miniprogram/init For Kbone, modify webpack configuration to add an app.js entry, update the mp-webpack-plugin generate options to specify the app entry, and initialize the DN SDK in src/app.js. Required parameters: user_action_set_id, secret_key, appid; optional: openid or unionid, user_unique_id, auto_track. This setup proxies the app lifecycle; dependencies include webpack and kbone plugins. ```javascript // webpack.mp.config.js module.exports = { entry:{ 'miniprogram-app': path.resolve(_dirname. '../src/app.js'), page1: path.resolve(_dirname, '../src/page1/main.mp.js'), page2: path.resolve(_dirname, '../src/page2/main.mp.js'), }, // ... other options } ``` ```javascript module.exports = { generate: { appEntry:'miniprogram-app', } // ... other options } ``` ```javascript import { SDK } from '@dn-sdk/miniprogram/build/index.js'; // import { SDK } from './lib/dn-sdk-miniprogram/index.js'; App({ onLaunch(options) {}, onShow(options) { }, onHide() {}, onError(err) {}, onPageNotFound(options) {}, DNSDK: new SDK({ // 数据源ID,必填 user_action_set_id: 'your_user_action_set_id', // 加密key,必填 secret_key: 'your_secret_key', // 微信小程序APPID,wx开头,必填 appid: 'wx123xyz123xyz123x', // 微信 openid,openid 和 unionid 只能填一个(优先填写openid), 可以调用 setOpenId 设置 openid: 'user_openid', // 微信 unionid,openid 和 unionid 只能填一个(优先填写openid), 可以调用 setUnionId 设置 unionid: 'user_unionid', // 自定义用户ID,选填 user_unique_id: 'user_unique_id', // 是否开启自动采集,选填,默认为true auto_track: true, }) }) ``` -------------------------------- ### Response example Source: https://datanexus.qq.com/doc/develop/guider/interface/conversion/trackingcgi_api_app This example shows a successful response from the DataNexus API, including a trace_id for debugging purposes. ```json { "code": 0, "message": "", "message_cn": {}, "trace_id": "ee1fe1f904985216ca4d761c07840d16_0" } ``` -------------------------------- ### Example Universal Link (iOS) Source: https://datanexus.qq.com/doc/develop/guider/interface/conversion/ad_track_click Shows an example of an iOS universal link used for app promotion. The link is encoded to ensure proper routing and tracking within the app. ```URL %25%25universal_link%25%25%3Fallianceid%3D1094307%26sid%3D2603989%26ouid%3Dzaoding2tu2_haogao_ios%26openapp%3D3 ``` -------------------------------- ### Example Request Body for Conversion Data Reporting Source: https://datanexus.qq.com/doc/develop/guider/interface/conversion/trackingcgi_api_official_accounts Example JSON structure for reporting conversion data to DataNexus. Includes user actions with different channels and action types. Supports up to 50 actions per request. ```json { "account_id": 1111111111, "user_action_set_id": 1111111111, "actions": [ { "outer_action_id": "示例唯一行为 id_请指定", "action_time": 1492998081, "user_id": { "wechat_openid": "", "wechat_unionid": "", "wechat_app_id": "" }, "action_type": "COMPLETE_ORDER", "custom_action": "my_type", "action_param": { "value": 28, "quantity": 5, "brand_name": "my_brand", "int_example": 123, "int_array_example": [123, 234], "double_example": 123.4500000000000028421709430404007434844970703125, "double_array_example": [123.45, 234.56], "bool_example": true, "bool_array_example": [true, false], "string_example": "123", "string_array_example": ["123", "234", "abc"] }, "product_inform": { "content_type": "EC", "category_path": [ "家用电器/厨房小电/豆浆机", "本地生活旅游出行/旅游出行/机票火车票" ] }, "trace": { "click_id": "abc" }, "channel": "NATURAL" }, { "outer_action_id": "示例唯一行为 id_请指定", "action_time": 1492998090, "user_id": { "hash_imei": "f9efca36a..." }, "action_type": "PURCHASE", "action_param": { "value": 28, "quantity": 5, "brand_name": "my_brand", "int_example": 123 }, "product_inform": { "content_type": "EC", "category_path": [ "家用电器/厨房小电/豆浆机", "本地生活旅游出行/旅游出行/机票火车票" ] }, "channel": "TENCENT" } ] } ``` -------------------------------- ### Get Conversion Attribution API Request Example (cURL) Source: https://datanexus.qq.com/doc/develop/guider/interface/ads_management/conversions_get Example of how to make a GET request to the Get Conversion Attribution API using cURL. This includes parameters for access token, timestamp, nonce, account ID, filtering, page number, and page size. ```bash curl -G 'https://api.e.qq.com/v1.1/conversions/get?access_token=×tamp=&nonce=' \ -d 'account_id=' \ -d 'filtering=[]' \ -d 'page=1' \ -d 'page_size=10' ``` -------------------------------- ### 启动广点通转化SDK Source: https://datanexus.qq.com/doc/develop/guider/sdk/harmony/init 调用`dnSDK.start()`方法来启动SDK的数据采集和上报功能。建议在初始化之后尽快调用此方法,以提高设备号填充率和归因成功率。 ```javascript dnSDK.start(); // 启动SDK,允许SDK采集个人信息 ``` -------------------------------- ### 初始化腾讯广告小游戏 SDK (LayaAir) Source: https://datanexus.qq.com/doc/develop/guider/sdk/minigame/init 在 LayaAir 引擎项目中初始化 SDK。通过 Laya.Script 的 onStart 生命周期方法实例化 SDK,并传入所需的初始化参数。 ```javascript import { SDK } from '@dn-sdk/minigame/build/index'; // import { SDK } from './lib/dn-sdk-minigame.min.js'; const { regClass, property } = Laya; @regClass() export class Main extends Laya.Script { onStart() { new SDK({ appid: 'wx123xyz123xyz123x', user_action_set_id: 'your_user_action_set_id', secret_key: '5e853xxxxxxxxxxd57a690xxxxxxxxxx', }); } } ``` -------------------------------- ### 下载并引入腾讯广告小游戏 SDK (文件) Source: https://datanexus.qq.com/doc/develop/guider/sdk/minigame/init 如果游戏引擎不支持 npm,可以手动下载 SDK 并通过文件路径引入。将解压后的 SDK 文件夹置于项目特定位置,然后使用 import 语句引用。 ```javascript import { SDK } from './lib/dn-sdk-minigame/index.js'; ``` -------------------------------- ### Complete WeChat Store Monitoring URL Example Source: https://datanexus.qq.com/doc/develop/guider/interface/conversion/ad_track_wechat_shop Full example of a monitoring URL for WeChat store purchases showing all supported macro parameters including adgroup_id, act_type, act_time, advertiser_id, dynamic_creative_id, and callback fields. ```url https://www.example.com/wechat_shop/?adgroup_id=__ADGROUP_ID__&act_type=__ACT_TYPE__&act_time=__ACT_TIME__&advertiser_id=__ADVERTISER_ID__&dynamic_creative_id=__DYNAMIC_CREATIVE_ID__&callback=__CALLBACK__ ``` -------------------------------- ### 上报启动应用行为 Source: https://datanexus.qq.com/doc/develop/guider/sdk/ios/init 在 App 的入口文件(AppDelegate.m)的 applicationDidBecomeActive 方法中调用 GDTAction logAction:actionParam: 方法,并传入 "START_APP" 作为行为类型,以报告应用启动行为。SDK 会自动判断是否为激活行为。 ```objective-c - (void)applicationDidBecomeActive:(UIApplication *)application { /* * 在应用启动的时候请上报GDTSDKActionNameStartApp行为 * SDK内部会判断此次启动行为是否为激活行为并上报,开发者无需另外作判断逻辑 */ [GDTAction logAction:@"START_APP" actionParam:@{}]; } ``` -------------------------------- ### SDK Initialization Source: https://datanexus.qq.com/doc/develop/guider/sdk/minigame/init How to initialize the SDK with necessary configuration parameters such as user action set ID, secret key, and AppID. ```APIDOC ## SDK Initialization ### Description Initializes the SDK with essential configuration. This typically involves providing a user action set ID, a secret key, and the WeChat Mini Program AppID. ### Method N/A (Code integration) ### Endpoint N/A (Internal configuration) ### Parameters N/A ### Request Example ```javascript import { SDK }from './index.js'; const sdk = new SDK({ // 数据源ID,数字,必填。 user_action_set_id: 123xxxx, // 加密key,必填。 secret)key: 'key', // 微信小游戏AppID,wx开头,必填。 appid: 'AppID' }; ``` ### Response N/A ``` -------------------------------- ### DataNexus Game Appointment Monitoring Configuration Source: https://datanexus.qq.com/doc/develop/guider/interface/conversion/ad_track_game_reserve This endpoint outlines the process of configuring monitoring links within DataNexus and binding them to advertisements for tracking Tencent advertising campaign data. It covers setup steps, parameter formatting, and link examples. ```APIDOC ## Configuration Overview ### Description This documentation provides a comprehensive guide to configuring and using game appointment monitoring links within the DataNexus platform. ### Method N/A (Configuration and Setup Documentation) ### Endpoint N/A ### Parameters #### Path Parameters - N/A #### Query Parameters - N/A #### Request Body - N/A ### Request Example N/A ### Response #### Success Response (200) - N/A #### Response Example N/A ## Configuration Steps ### 2.1 DataNexus Configuration 1. Access the - page. 2. Enter the 'Monitoring Link Group Name'. 3. Select 'Android App' or 'iOS App' for 'Marketing Carrier Type'. 4. Enter the monitoring link in the 'Game Appointment Monitoring' field. ### 2.2 Binding Monitoring Links to Ads #### Scheme 1: Binding via Conversion Rules ##### 1) Binding to Conversion Rules Access the 'Effect Analysis - Conversion Attribution' page. Select the monitoring link group in the 'Monitoring Link Type'. ##### 2) Binding Ads to Conversion Rules Select the corresponding conversion ID in the ad. ##### 3) Link Testing Access the 'Effect Analysis - Conversion Attribution' page and click 'Conversion Testing'. #### Scheme 2: Direct Binding to Ads ##### 1) Binding to Ads Select the monitoring link group on the promotion page. ##### 2) Link Testing Access the 'Promotion - Ad' page and click 'Online Preview'. Refer to the 'Online Preview Feature Usage Guide'. ## Formatting Requirements Monitoring links generally follow the format `https://XXXX.XXX.com?+parameters`. (1) The prefix format is: `https://XXX.XXX.com? (2) Macro format: '__parameter__' - parameters must be in ALL CAPS and cannot contain #. Refer to the list for supported parameters. (3) Custom parameters can be added: `https://xx.xx.com?planid=123&channel=ams&click_id=__CLICK_ID__ (4) Links can start with http or https; cannot use an IP address. https requires formal domain names and does not support SNI. ## Link Examples ### Android ``` https://www.example.com/click/?click_id=__CLICK_ID__&click_time=__CLICK_TIME__&impression_time=__IMPRESSION_TIME__&adgroup_id=__ADGROUP_ID__&ad_platform_type=__AD_PLATFORM_TYPE__&ad_type=__AD_TYPE__&account_id=__ACCOUNT_ID__&agency_id=__AGENCY_ID__&billing_event=__BILLING_EVENT__&deeplink_url=__DEEPLINK_URL__&page_url=__PAGE_URL__&device_os_type=__DEVICE_OS_TYPE__&process_time=__PROCESS_TIME__&promoted_object_id=__PROMOTED_OBJECT_ID__&request_id=__REQUEST_ID__&callback=__CALLBACK__&impression_id=__IMPRESSION_ID__&adgroup_name=__ADGROUP_NAME__&dynamic_creative_id=__DYNAMIC_CREATIVE_ID__&dynamic_creative_name=__DYNAMIC_CREATIVE_NAME__&creative_components_info=__CREATIVE_COMPONENTS_INFO__&marketing_goal=__MARKETING_GOAL__&marketing_sub_goal=__MARKETING_SUB_GOAL__&marketing_target_id=__MARKETING_TARGET_ID__&marketing_carrier_id=__MARKETING_CARRIER_ID__&marketing_sub_carrier_id=__MARKETING_SUB_CARRIER_ID__&marketing_asset_id=__MARKETING_ASSET_ID__&material_package_id=__MATERIAL_PACKAGE_ID__&hash_android_id=__HASH_ANDROID_ID__&hash_oaid=__HASH_OAID__&muid=__MUID__&act_type=__ACT_TYPE__&act_time=__ACT_TIME__ ``` ### iOS ``` https://www.example.com/click/?click_id=__CLICK_ID__&click_time=__CLICK_TIME__&impression_time=__IMPRESSION_TIME__&adgroup_id=__ADGROUP_ID__&ad_platform_type=__AD_PLATFORM_TYPE__&ad_type=__AD_TYPE__&account_id=__ACCOUNT_ID__&agency_id=__AGENCY_ID__&page_url=__PAGE_URL__&device_os_type=__DEVICE_OS_TYPE__&process_time=__PROCESS_TIME__&promoted_object_id=__PROMOTED_OBJECT_ID__&request_id=__REQUEST_ID__&callback=__CALLBACK__&impression_id=__IMPRESSION_ID__&adgroup_name=__ADGROUP_NAME__&dynamic_creative_id=__DYNAMIC_CREATIVE_ID__&dynamic_creative_name=__DYNAMIC_CREATIVE_NAME__&creative_components_info=__CREATIVE_COMPONENTS_INFO__&marketing_goal=__MARKETING_GOAL__&marketing_sub_goal=__MARKETING_SUB_GOAL__&marketing_target_id=__MARKETING_TARGET_ID__&marketing_carrier_id=__MARKETING_CARRIER_ID__&marketing_sub_carrier_id=__MARKETING_SUB_CARRIER_ID__&marketing_asset_id=__MARKETING_ASSET_ID__&material_package_id=__MATERIAL_PACKAGE_ID__&muid=__MUID__&caid=__CAID__&act_type=__ACT_TYPE__&act_time=__ACT_TIME__ ``` __ADGROUP_ID__ represents a macro that will be replaced with the actual ADGROUP_ID. ``` -------------------------------- ### Conversion Data Response Structure Source: https://datanexus.qq.com/doc/develop/guider/interface/ads_management/conversions_get This section describes the structure of the response body for conversion data, including details about the list of conversions, individual conversion attributes, and pagination information. It also provides an example of a successful response. ```APIDOC ## Conversion Data API ### Description This endpoint returns a list of conversion data, including details about each conversion and pagination information. ### Method GET ### Endpoint /websites/datanexus_qq_doc_develop/conversions ### Parameters #### Query Parameters - **page** (integer) - Optional - Current page number. - **page_size** (integer) - Optional - Number of items per page (default: 10, min: 1, max: 100). ### Response #### Success Response (200) - **list** (array) - A list of conversion objects. - **conversion_id** (integer) - The conversion ID. - **conversion_name** (string) - The name of the conversion (max 60 Chinese characters or 120 English characters). - **access_type** (enum) - The reporting method (see Enum values). - **claim_type** (enum) - The attribution method (see Enum values). - **feedback_url** (string) - Monitoring URL for click tracking. - **self_attributed** (boolean) - Whether the conversion is self-attributed. - **optimization_goal** (enum) - The optimization goal type (see Enum values). - **deep_behavior_optimization_goal** (enum) - Deep behavior optimization goal (see Enum values). - **is_deleted** (boolean) - Whether the conversion is deleted. - **app_android_channel_package_id** (string) - Android app channel package ID. - **promoted_object_id** (string) - The promoted object ID. - **conversion_scene** (enum) - The conversion scene. - **page_info** (object) - Pagination information. - **page** (integer) - Current page number. - **page_size** (integer) - Number of items per page. - **total_number** (integer) - Total number of items. - **total_page** (integer) - Total number of pages. #### Response Example ```json { "code": 0, "message": "", "message_cn": "", "data": { "list": [ { "conversion_id": 12345, "conversion_name": "测试转化", "access_type": "ACCESS_TYPE_API", "claim_type": "CLAIM_TYPE_ACTIVATION", "feedback_url": "http://wwww.qq.com?a=__CLICK_ID__&b=__CLICK_TIME__&c=__MUID__&d=__ACCOUNT_ID__&f=__CALLBACK__&g=__DEVICE_OS_TYPE__&h=__HASH_MAC__&i=__HASH_OAID__&j=__OAID__&k=__HASH_ANDROID_ID__&l=__PROMOTED_OBJECT_ID__&o=__AD_ID__", "self_attributed": true, "optimization_goal": "OPTIMIZATIONGOAL_APP_ACTIVATE", "deep_behavior_optimization_goal": "OPTIMIZATIONGOAL_APP_REGISTER", "is_deleted": false, "app_android_channel_package_id": "0;10000534", "promoted_object_id": "100873919", "conversion_scene": "CONVERSION_SCENE_ANDROID" } ], "page_info": { "page": 1, "page_size": 10, "total_number": 1, "total_page": 1 } } } ``` ``` -------------------------------- ### Get User Action Reports (cURL) Source: https://datanexus.qq.com/doc/develop/guider/interface/data_source/user_action_set_reports_get Example of how to fetch user action reports using cURL. This demonstrates the necessary parameters for authentication, account and user action set IDs, date range, time granularity, and aggregation. ```cURL curl -G 'https://api.e.qq.com/v1.1/user_action_set_reports/get?access_token=×tamp=&nonce=' \ -d 'account_id=' \ -d 'user_action_set_id=1111111111' \ -d 'date_range={"start_date":"YYYY-MM-DD","end_date":"YYYY-MM-DD"}' \ -d 'time_granularity=HOURLY' \ -d 'aggregation=DOMAIN' ``` -------------------------------- ### 启动 SDK 采集数据 Source: https://datanexus.qq.com/doc/develop/guider/sdk/android/init 调用 start 方法以允许 SDK 采集用户信息。必须在 init 方法调用后尽快执行,否则影响设备号填充率和归因结果准确性。 ```Java GDTAction.start(); // 启动SDK,允许SDK采集个人信息 ``` -------------------------------- ### Manual Event Reporting Methods (JavaScript) Source: https://datanexus.qq.com/doc/develop/guider/sdk/miniprogram/init Provides examples of dedicated reporting methods for common user actions in WeChat Mini Programs. These methods should be preferred for reporting data when automatic collection is not sufficient or needs to be augmented. They cover app lifecycle events and page navigation. ```javascript sdk.onAppStart(); sdk.onAppQuit(); sdk.onEnterForeground(); sdk.onEnterBackground(); sdk.onPageShow(); sdk.onPageHide(); ``` -------------------------------- ### 上报应用启动行为 (通过 Universal Links) Source: https://datanexus.qq.com/doc/develop/guider/sdk/ios/init 当 App 通过 Universal Links 被第三方应用唤起时,应在 App 入口文件的 continueUserActivity:restorationHandler: 回调方法中调用 GDTAction logAction:actionParam: 方法上报 START_APP 行为。行为参数中需包含呼起的 webpageURL 链接。 ```objective-c -(BOOL) application:(UIApplication *) application continueUserActivity:(NSUserActivity *) userActivity restorationHandler:(void (^)(NSArray> * _Nullable)) restorationHandler { if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { NSURL *url = userActivity.webpageURL; if (url) { /* * 在应用被呼起的时候请上报GDTSDKActionNameStartApp行为,并带上呼起的webpageURL链接 */ [GDTAction logAction:@"START_APP" actionParam:@{@"open_url": url.absoluteString}]; } } return true; } ``` -------------------------------- ### Unity小游戏GameGlobal模块导入配置 Source: https://datanexus.qq.com/doc/develop/guider/sdk/minigame/init Unity小游戏入口文件导入必要的运行时模块和SDK配置。包含纹理配置、命名空间、WASM框架、版本检查和字体预加载等。依赖微信小游戏环境和Unity运行时,为SDK功能提供基础支持。 ```javascript import'./texture-config'; import unityNamespace from './unity-namespace'; import '.$DOTNET_RUNTIME_FOLD/$GAME_NAME.wasm.framework.unityweb'; import './unity-sdk/index'; import checkVersion from './check-version'; import { launchEventType, scaleMode } from './plugin-config'; import { preloadWxCommonFont } from './unity-sdk/font/index'; import './dn-sdk-minigame/dn-sdk'; //微信小游戏插件game.js里import dn-sdk.js。 //在jslib里通过微信小游戏插件的GameGlobal这个全局变量调用js的函数。 ``` -------------------------------- ### 导入 GDTAction SDK 头文件 Source: https://datanexus.qq.com/doc/develop/guider/sdk/ios/init 在需要使用广点通转化 SDK 的文件中导入 GDTAction.h 和 GDTAction+convenience.h 头文件,以便调用 SDK 提供的功能。这是使用 SDK 的前提。 ```objective-c #import "GDTAction.h" #import "GDTAction+convenience.h" ``` -------------------------------- ### 下载并引入腾讯广告小游戏 SDK (npm) Source: https://datanexus.qq.com/doc/develop/guider/sdk/minigame/init 通过 npm 安装腾讯广告小游戏 SDK,并使用 import 方式将其引入到项目中。此方式适用于支持 npm 包管理的开发环境。 ```bash npm i @dn-sdk/minigame ``` ```javascript import { SDK } from '@dn-sdk/minigame'; ``` -------------------------------- ### Reporting User Events with Track Method Source: https://datanexus.qq.com/doc/develop/guider/sdk/miniprogram/init Use the track method on the SDK instance to report user behavior events in WeChat Mini Programs. The method requires an action_type string (e.g., from enums like PURCHASE) and an optional action_param object for custom properties (Key: string with letters/numbers/underscores; Value: string/number/boolean/object). Limitations: Keys must start with a letter, max 255 chars; nested objects limited to primitive values. ```javascript sdk.track(action_type, [,action_param]); ``` ```javascript // 上报付费行为 sdk.track('PURCHASE', { value: 600, // 付费金额 }); ``` -------------------------------- ### GET /v3.0/conversions/get Source: https://datanexus.qq.com/doc/develop/guider/interface/ads_management/conversions_get This endpoint retrieves conversion attribution data for a given account. It supports filtering and pagination options to refine the results. ```APIDOC ## GET /v3.0/conversions/get ### Description Retrieves conversion attribution data for a given account. ### Method GET ### Endpoint /v3.0/conversions/get ### Parameters #### Path Parameters - **None** #### Query Parameters - **access_token** (string) - Required - Authorization token obtained after OAuth 2.0 authentication. - **timestamp** (integer) - Required - Current timestamp in seconds. Must be within 300 seconds of the current time. - **nonce** (string) - Required - A unique random string, no more than 32 characters. - **fields** (string) - Optional - A list of fields to return in the response. #### Request Body - **account_id** (integer) - Required - The ID of the promotion account or DataNexus account. - **filtering** (array) - Optional - Filter conditions. Empty array indicates no restrictions. - **field** (string) - Required - The field to filter by. Possible values: { conversion_id, promoted_object_type, promoted_object_id, conversion_name, site_set, optimization_goal, deep_behavior_optimization_goal, deep_worth_optimization_goal, deep_worth_advanced_goal, access_status, cost_type, create_source_type, app_android_channel_package_id, marketing_scene, live_video_mode, live_video_sub_mode, conversion_link_id, impression_feedback_url, attribution_window, campaign_type } - **operator** (enum) - Required - The operator for the filter. Values depend on the `field`. - **values** (string[]) - Required - The values to filter against. The number of values in the array depends on the operator. - **page** (integer) - Optional - The page number to retrieve. Default: 1, Max: 99999. - **page_size** (integer) - Optional - The number of results per page. Default: 10, Max: 2000. ### Request Example ```bash curl -G 'https://api.e.qq.com/v3.0/conversions/get?access_token=×tamp=&nonce=' \ -d 'account_id=' \ -d 'filtering=[]' \ -d 'page=1' \ -d 'page_size=10' ``` ### Response #### Success Response (200) - **data** (object) - The conversion attribution data. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### SDK init Method Source: https://datanexus.qq.com/doc/develop/guider/sdk/harmony/init Initializes the SDK with context and authentication details. This method should be called once in the app's entry point after user consent, enabling other SDK functions. ```APIDOC ## init ### Description Initializes the SDK with required parameters. This sets up the context, user action set ID, secret key, and other optional settings for data collection. ### Method init ### Parameters #### Request Body - **context** (Context) - Required - The context from the UIAbility. - **user_action_set_id** (number) - Required - The behavior data source ID from DataNexus. - **secret_key** (string) - Required - The secret key for DataNexus data access. - **show_log** (boolean) - Optional - Whether to show logs; defaults to false. - **user_unique_id** (string) - Optional - Business user ID. ### Request Example { "context": "this.context", "user_action_set_id": 123xxxx, "secret_key": "9c6f7ef44xxxxxx", "show_log": false } ### Response #### Success Response (Initializes successfully) - No specific response data; enables SDK functions. #### Response Example {} ```