A Qt Quick application using Qt Insight Tracker.
要运行范例从 Qt Creator ,打开 欢迎 模式,然后选择范例从 范例 。更多信息,拜访 构建和运行范例 .
The example shows how to integrate Qt Insight Tracker to your Qt Quick application.
In the example, InsighTracker singleton is configured and then enabled.
InsightConfiguration { syncInterval: 60 } Component.onCompleted: InsightTracker.enabled = true;
The example is using states to control the UI layouts. Qt Insight can be then easily used to track the transitions in the UI flow either from QML:
onStateChanged: InsightTracker.transition(applicationFlow.state);
or from C++:
tracker.transition("initial");
Button presses can also be tracked.
MouseArea {
anchors.fill: parent
onClicked: {
root.clicked()
InsightTracker.interaction(root.text, root.InsightCategory.category);
}
onPressed: {
glow.visible = true
animation1.start()
animation2.start()
}
}
An attached property InsightCategory can be used in the QML components. It can be used to filter the tracked events.
CoffeeButton {
id: cappuccinoButton
text: "Cappuccino"
InsightCategory.category: "coffee"
}
Tracked events are always associated with a session, which is always new for each application launch. A new session can also be created if needed. In the example, this is done when the UI is reset back to the initial state.
ScriptAction {
script: InsightTracker.startNewSession();
}