QInsightConfiguration Class▲
-
Header: QInsightConfiguration
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS InsightTracker)
target_link_libraries(mytarget PRIVATE Qt6::InsightTracker)
-
qmake: QT += insighttracker
-
Inherited By:
-
Instantiated By: qml-qtinsighttracker-insightconfiguration.xml
-
Inherits: QObject
I. Detailed Description▲
Use QInsightConfiguration to configure the tracker. You must make all configuration changes before enabling the tracking. The tracker reads default values from a configuration file (qtinsight.conf), which is searched from following the locations in a decending order:
-
Application's resources file.
-
Application's directory.
-
Current working directory.
-
System configuration directories as defined by QStandardPaths::GenericConfigLocation.
Use an environment variable QT_INSIGHT_CONFIG to override the used configuration file.
Example of a JSON configuration file:
{
"server"
: "collect-insight.qt.io"
,
"token"
: "00000000-0000-0000-0000-000000000000"
,
"device_model"
: "model 1"
,
"device_variant"
: "a"
,
"device_screen_type"
: "NON_TOUCH"
,
"platform"
: "app"
,
"app_build"
: "1.2.3"
,
"storage"
: "SQLITE"
,
"storage_path"
: ""
,
"sync"
: {
"interval"
: {
"seconds"
: 0
"minutes"
: 0
"hours"
: 1
"days"
: 0
"months"
: 0
}
,
"max_batch_size"
: 100
}
}
A token is used to match the data your application sends to your Qt Insight Organization and you can find your token from the Qt Insight Console.
Some of the configuration items are directly linked to the Snowblow Tracker Protocol, which defines the allowed values. These include QInsightConfiguration::setPlatform() and QInsightConfiguration::setDeviceScreenType().
QInsightConfiguration::setStorageType() can be used to configure the storage type, where SQLITE is the default value and use SQLite database to store the events before they are sent to the back-end server. If an unknown storage type is specified or it is explicitly set to an empty string, caching will be disabled. In that case the tracked data will be lost if the back-end server isn't available.
QInsightConfiguration::setStoragePath() can be used to configure the location of the storage. By default, the SQLite database is created in the application's directory.
QInsightConfiguration::setSyncInterval() can be used to configure how often the tracked events are sent to the back-end server. The API takes the value in seconds, while the json configuration file can be configured also with more natural minutes, hours, days, and months. If sync interval is not set, events will never be sent to the backend and cached only in the local storage.
QInsightConfiguration::setBatchSize is used to minimize the overhead when sending, reading and writing to the storage. When synchronizing the cached data to back-end server, at most QInsightConfiguration::batchSize() items will be fetched at once from the storage and sent to back-end server. This is more optimal, than fetching the data one by one. The sent data will be removed from the storage also in batches. The process repeats, until all data is sent. If one batch fails, the synchronization will stop, as the next batches will likely also fail.
II. Member Function Documentation▲
II-1. QInsightConfiguration::QInsightConfiguration(QObject *parent = nullptr)▲
Construct a new configuration object with the given parent.
II-2. QString QInsightConfiguration::appBuild() const▲
Returns current application's build version.
Getter function for property appBuild.
II-2-1. See Also▲
See also setAppBuild()
II-3. int QInsightConfiguration::batchSize() const▲
Returns current sync batch size.
Getter function for property batchSize.
II-3-1. See Also▲
See also setBatchSize()
II-4. QStringList QInsightConfiguration::categories()▲
Returns currently enabled categories.
Getter function for property categories.
II-4-1. See Also▲
See also setCategories()
II-5. QString QInsightConfiguration::deviceModel() const▲
Returns current device model.
Getter function for property deviceModel.
II-5-1. See Also▲
See also setDeviceModel()
II-6. QString QInsightConfiguration::deviceScreenType() const▲
Returns current screen type.
Getter function for property deviceScreenType.
II-6-1. See Also▲
See also setDeviceScreenType()
II-7. QString QInsightConfiguration::deviceVariant() const▲
Returns current device variant.
Getter function for property deviceVariant.
II-7-1. See Also▲
See also setDeviceVariant()
II-8. QStringList QInsightConfiguration::events()▲
Returns currently enabled events.
Getter function for property event.
II-8-1. See Also▲
See also setEvents()
II-9. bool QInsightConfiguration::isValid()▲
Returns true if configuratio is valid.
II-10. bool QInsightConfiguration::load()▲
Load existing configurations from a file. Returns true is configuration was successfully loaded.
II-11. QString QInsightConfiguration::platform() const▲
Returns current platform.
Getter function for property platform.
II-11-1. See Also▲
See also setPlatform()
II-12. QString QInsightConfiguration::server() const▲
Returns current server address.
Getter function for property server.
II-12-1. See Also▲
See also setServer()
II-13. void QInsightConfiguration::setAppBuild(const QString &appBuild)▲
Set application's build version appBuild.
Setter function for property appBuild.
II-13-1. See Also▲
See also appBuild()
II-14. void QInsightConfiguration::setBatchSize(int batchSize)▲
Set sync batch size to batchSize. Defines how many events are sent to network in one go.
Setter function for property batchSize.
II-14-1. See Also▲
See also batchSize()
II-15. void QInsightConfiguration::setCategories(const QStringList &categories)▲
Set list of enabled categories to categories.
Setter function for property categories.
II-15-1. See Also▲
See also categories()
II-16. void QInsightConfiguration::setDeviceModel(const QString &deviceModel)▲
Set device model to deviceModel.
Setter function for property deviceModel.
II-16-1. See Also▲
See also deviceModel()
II-17. void QInsightConfiguration::setDeviceScreenType(const QString &deviceScreenType)▲
Set device screen type to deviceScreenType.
Setter function for property deviceScreenType.
II-17-1. See Also▲
See also deviceScreenType()
II-18. void QInsightConfiguration::setDeviceVariant(const QString &deviceVariant)▲
Set device variant to deviceVariant.
Setter function for property deviceVariant.
II-18-1. See Also▲
See also deviceVariant()
II-19. void QInsightConfiguration::setEvents(const QStringList &events)▲
Set list of enabled events to events.
Setter function for property event.
II-19-1. See Also▲
See also events()
II-20. void QInsightConfiguration::setPlatform(const QString &platform)▲
Set platform to platform
Setter function for property platform.
II-20-1. See Also▲
See also platform()
II-21. void QInsightConfiguration::setServer(const QString &server)▲
Set server address to server.
Setter function for property server.
II-21-1. See Also▲
See also server()
II-22. void QInsightConfiguration::setStoragePath(const QString &storagePath)▲
Set storage path to storagePath.
Setter function for property storagePath.
II-22-1. See Also▲
See also storagePath()
II-23. void QInsightConfiguration::setStorageSize(int storageSize)▲
Set storage size to storageSize.
Setter function for property storageSize.
II-23-1. See Also▲
See also storageSize()
II-24. void QInsightConfiguration::setStorageType(const QString &storageType)▲
Set storage type to storageType.
Setter function for property storageType.
II-24-1. See Also▲
See also storageType()
II-25. void QInsightConfiguration::setSyncInterval(int syncInterval)▲
Set sync interval to syncInterval seconds.
Setter function for property syncInterval.
II-25-1. See Also▲
See also syncInterval()
II-26. void QInsightConfiguration::setToken(const QString &token)▲
II-27. QString QInsightConfiguration::storagePath() const▲
Returns current storage path.
Getter function for property storagePath.
II-27-1. See Also▲
See also setStoragePath()
II-28. int QInsightConfiguration::storageSize() const▲
Returns current storage size.
Getter function for property storageSize.
II-28-1. See Also▲
See also setStorageSize()
II-29. QString QInsightConfiguration::storageType() const▲
Returns current storage type.
Getter function for property storageType.
II-29-1. See Also▲
See also setStorageType()
II-30. int QInsightConfiguration::syncInterval() const▲
Returns current sync interval in seconds.
Getter function for property syncInterval.
II-30-1. See Also▲
See also setSyncInterval()