Qt Insight - Qt Quick Application▲
Running the Example▲
To run the example from Qt Creator, open the Welcome mode and select the example from Examples. For more information, visit Building and Running an Example.
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 UI flow.
onStateChanged
:
InsightTracker.sendScreenView(applicationFlow.state);
Button presses can also be tracked.
MouseArea
{
anchors.fill
:
parent
onClicked
: {
root.clicked
(
)
InsightTracker.sendClickEvent
(
root.
text
,
root.
InsightCategory.
category,
mouseX,
mouseY);
}
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();
}