Basic integration

更新时间: 2026-06-17 11:53:53

1. Compliant initialization

1.1 Initialization API

1. Compliance statement

Data privacy regulations prohibit collecting personal information before a user agrees to your privacy policy. To comply, Quick Tracking requires you to initialize the SDK as follows:

  1. You must display this policy and obtain user consent on the application's first launch.

  2. You must inform users that you use the Quick Tracking SDK. Add the following sample clause to your privacy policy:

"Our product integrates the Quick Tracking SDK, which collects your OS, OS version, memory, MAC address, CPU, timezone, language, resolution, device manufacturer, and device model to provide statistical analysis services."

2. Compliant initialization

To comply with data privacy regulations, call the initialization function only after the user consents to your privacy policy. The SDK does not collect or report any data until initialized.

/** Initializes all components of the Quick Tracking product.
*   The `param` parameter must be serialized using the QT::Helper::QT_Serializable method provided by QTForPCHelper.
*/
QTFORPC_API QT_VOID initQTPC(QT_CSTR strAppKey, QT_CSTR strProcessName, QT_CSTR strTrackDomain, QT_MAP param);

Parameter

Type

Description

Required

strAppKey

const char *

The unique ID for your application, provided by Quick Tracking.

Yes

strProcessName

const char *

The application process name.

Yes

strTrackDomain

const char *

The full endpoint URL for log uploads, which must end with /event.

Yes

param

const char *

Additional configuration parameters. Pass as a map and serialize by calling QT::Helper::QT_Serializable.

  1. appVersion: The application version number.

  2. channel: The application channel.

  3. maxCacheDay: The maximum local log cache duration in days. Default: 3. Max: 366. Min: 1.

  4. maxReportDataSize: The number of records per aggregated report batch. Default: 300. Max: 300. Min: 1.

No

Example:

QT_INTERFACE_PTR qtInterface = NULL;
try
{
    qtInterface = loadQTDLL(L"QTForPC.dll");
	if (!qtInterface)
	{
		fprintf(stderr, "Error loading dll: %lx\n", -1);
		return -1;
	}

    std::map<string, string> param;
	param["appVersion"] = "testVersion";
	param["channel"] = "testChannel";
	param["maxCacheDay"] = "60";
	param["maxReportDataSize"] = "100";
	std::string sparam;
	QT::Helper::QT_Serializable(sparam, param);
			
    qtInterface->initQTPC("appKey", "processname", "http://xxxxx/event", sparam.c_str());
    ......

}
catch (...)
{
    return -1;
}

system("pause");
freeQTDLL(qtInterface);

1.2 Getting the Appkey

SDK initialization requires an Appkey, a unique identifier for your application in Quick Tracking. The Appkey is generated when you create the application. To find your Appkey, see application management.

2. Logging

To control Quick Tracking's log output, call the setQTLog function.

// Enables logging. 
// LOG_PRINT_TYPE_NONE: No output.
// LOG_PRINT_TYPE_STDOUT: Standard output (stdout).
// LOG_PRINT_TYPE_FILE: File output. The output directory is %appdata%/qtforpc/appkey/.
QTFORPC_API QT_VOID setQTLog(QT_CSTR strAppKey, QT_CSTR strProcessName, LOG_PRINT_TYPE type);

Parameter

Type

Description

Required

strAppKey

const char *

The unique ID for your application, provided by Quick Tracking.

Yes

strProcessName

const char *

The application process name.

Yes

type

enum LOG_PRINT_TYPE

The log output destination.

  • LOG_PRINT_TYPE_NONE: None

  • LOG_PRINT_TYPE_STDOUT: Standard output (stdout)

  • LOG_PRINT_TYPE_FILE: File output. Logs are saved to %appdata%/qtforpc/appkey/.

Yes

Important

Note:

  • You must call setQTLog before initQTPC to enable logging.

Example:

// Enable logging
qtInterface->setQTLog("appKey", "processname", LOG_PRINT_TYPE::LOG_PRINT_TYPE_FILE);
// Initialize the SDK
qtInterface->initQTPC("appKey", "processname", "http://xxxxx/event", sparam.c_str());

3. Log reporting policy

The Quick Tracking Windows SDK uses the following default log reporting policy:

  • The SDK uses aggregated reporting and sends logs in batches of 300 by default. Configure the batch size with the maxReportDataSize parameter in initQTPC.

  • The SDK sends logs every 3 seconds.

上一篇: Introducing and configuring the SDK 下一篇: Tracking API
阿里云首页 全域采集与增长分析 相关技术圈