Qt Insight - Qt Quick Application

A Qt Quick application using Qt Insight Tracker.

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 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);
            InsightTracker.dimensionData("CoffeeType", root.text);
        }
        onPressed: {
            glow.visible = true
            animation1.start()
            animation2.start()
        }
    }

The example above also sends custom dimension CoffeeType that can be used in the Insight Console to filter sessions that selected specific coffee variety.

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();
        }

Example project @ code.qt.io

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.