### Featured Page Example Source: https://telemetrydeck.com/docs/articles/documentation Mark a documentation page as 'featured' using the 'featured' metadata key to highlight it on the 'Getting Started' page. ```yaml featured: true ``` -------------------------------- ### Experiment Query Example Source: https://telemetrydeck.com/docs/tql/experiment This example demonstrates how to set up an experiment query to compare user success between 'Payscreen A' and 'Payscreen B' based on 'Payment Succeeded' events. It requires defining two samples and a success criterion, each with a name and a filter. ```json { "granularity": "all", "queryType": "experiment", "sample1": { "filter": { "dimension": "type", "type": "selector", "value": "payScreenALaunched" }, "name": "Payscreen A" }, "sample2": { "filter": { "dimension": "type", "type": "selector", "value": "payScreenBLaunched" }, "name": "Payscreen B" }, "successCriterion": { "filter": { "dimension": "type", "type": "selector", "value": "paymentSucceeded" }, "name": "Payment Succeeded" } } ``` -------------------------------- ### Install TelemetryDeck React SDK Source: https://telemetrydeck.com/docs/guides/react-setup Install the TelemetryDeck React SDK using NPM or Yarn. This is a prerequisite for setting up the SDK in your project. ```bash npm install -S @typedigital/telemetrydeck-react ``` -------------------------------- ### Tested On Example Source: https://telemetrydeck.com/docs/articles/documentation Use the 'testedOn' metadata to indicate the specific versions of software or SDKs that the documentation and code examples were tested against. This helps readers assess potential compatibility issues. ```yaml testedOn: Xcode 12.2 & Swift 5.3 ``` -------------------------------- ### Full Document Metadata Example Source: https://telemetrydeck.com/docs/articles/documentation An example of comprehensive YAML frontmatter for a documentation page, including optional fields like tags, testedOn, featured, description, meta_title, meta_description, and order. ```yaml --- title: Setting up your application in SwiftUI tags: - Setup - Quickstart - Code testedOn: Xcode 12.2 & Swift 5.3 featured: true description: How to configure TelemetryClient in SwiftUI based applications lead: In Scene-based SwiftUI applications, this is how you configure TelemetryClient meta_title: Setting up your SwiftUI application with TelemetryDeck meta_description: How to configure TelemetryDeck SDK in SwiftUI based applications order: 1337 --- ``` -------------------------------- ### Install Expo Dependencies Source: https://telemetrydeck.com/docs/guides/react-setup Install expo-crypto and text-encoding for Expo projects to enable TelemetryDeck functionality. ```bash npm i -S expo-crypto text-encoding ``` -------------------------------- ### QueryContext Configuration Example Source: https://telemetrydeck.com/docs/tql/queryContext This snippet shows how to configure a query context, specifying priority, grand total inclusion, and cache validity duration. ```json "context": { "priority": -1, "grandTotal": true, "cacheValidityDuration": 1440 } ``` -------------------------------- ### Markdown Table Example Source: https://telemetrydeck.com/docs/articles/documentation Demonstrates how to create a markdown table with headers and rows. This is useful for presenting structured data. ```markdown | Name | Description | | ------- | ------------------------------------------------------------------------------------------------------------------ | | `title` | The title of the page. This is used in the left sidebar, at the top of the page and in the "Getting Started" page. | ``` -------------------------------- ### Setup TelemetryDeckProvider Source: https://telemetrydeck.com/docs/guides/react-setup Create a TelemetryDeck instance with your App ID and client user, then pass it to the TelemetryDeckProvider. This component should be placed high in your component tree. ```typescript import * as React from "react"; import * as ReactDOM from "react-dom"; import { TelemetryDeckProvider, createTelemetryDeck, } from "@typedigital/telemetrydeck-react"; import { Dashboard } from "./Dashboard"; const td = createTelemetryDeck({ appID: process.env.APP_ID, clientUser: "anonymous" }); const App = () => { return (
); }; ReactDOM.render(, document.getElementById("root")); ``` -------------------------------- ### Page Order Example Source: https://telemetrydeck.com/docs/articles/documentation Specify the 'order' metadata value to control the display order of pages in the sidebar and navigation links. ```yaml order: 42 ``` -------------------------------- ### Install TelemetryDeck JavaScript SDK Source: https://telemetrydeck.com/docs/guides/web-setup Add this script to the `` section of your website to integrate TelemetryDeck. Replace `` with your actual TelemetryDeck App ID. ```html ``` -------------------------------- ### Single Tag Example Source: https://telemetrydeck.com/docs/articles/documentation Use the 'tags' metadata to assign a single tag to a documentation page for organization. ```yaml tags: Swift ``` -------------------------------- ### Install TelemetryDeck Vue Package Source: https://telemetrydeck.com/docs/guides/vue-setup Install the TelemetryDeck Vue package using npm. This is the first step to integrating TelemetryDeck into your Vue.js application. ```bash npm i @peerigon/telemetrydeck-vue --save ``` -------------------------------- ### Funnel Query Example Source: https://telemetrydeck.com/docs/tql/funnel This query returns the number of users that went through the funnel steps Login -> View Product -> Purchase. Define each step with a name and a filter. ```json { "queryType": "funnel", "granularity": "all", "steps": [ { "name": "Login", "filter": { "type": "selector", "dimension": "type", "value": "Login" } }, { "name": "View Product", "filter": { "type": "selector", "dimension": "type", "value": "View Product" } }, { "name": "Purchase", "filter": { "type": "selector", "dimension": "type", "value": "Purchase" } } ] } ``` -------------------------------- ### Multiple Tags Example Source: https://telemetrydeck.com/docs/articles/documentation Assign multiple tags to a documentation page by listing them under the 'tags' metadata key. These tags help in organizing and linking related pages. ```yaml tags: - Setup - Quickstart - Code - Swift ``` -------------------------------- ### Top N Query Example Source: https://telemetrydeck.com/docs/tql/topN This snippet demonstrates how to construct a Top N query to find the top 10 app versions by user count, filtered by a specific app ID. It specifies the aggregation, dimension, metric, and threshold for the query. ```json { "aggregations": [{ "name": "count", "type": "count" }], "dimension": { "dimension": "appVersion", "outputName": "appVersion", "type": "default" }, "granularity": "all", "metric": { "ordering": "version", "type": "dimension" }, "filter": { "dimension": "appID", "type": "selector", "value": "AAABBBCCC" }, "queryType": "topN", "threshold": 10 } ``` -------------------------------- ### Initialize TelemetryDeck in SwiftUI App Source: https://telemetrydeck.com/docs/articles/telemetry-client Example of initializing the TelemetryDeck client within the `init()` function of a SwiftUI `App` struct. This ensures initialization occurs before the window is presented. ```swift import SwiftUI import TelemetryDeck @main struct TelemetryTestApp: App { var body: some Scene { WindowGroup { ContentView() } } init() { // Note: Do not add this code to `WindowGroup.onAppear`, which will be called // *after* your window has been initialized, and might lead to out initialization // occurring too late. let config = TelemetryDeck.Config(appID: "") TelemetryDeck.initialize(config: config) } } ``` -------------------------------- ### GroupBy Query for Operating System Versions Source: https://telemetrydeck.com/docs/tql/query This example groupBy query groups signals by the 'majorSystemVersion' dimension and aggregates them by the 'count' metric, resulting in the number of operating system versions. It requires 'granularity', 'dataSource', and 'queryType'. ```json { "queryType": "groupBy", "granularity": "all", "dimensions": [ { "dimension": "majorSystemVersion", "outputName": "Major System Version", "outputType": "STRING", "type": "default" } ], "aggregations": [ { "name": "Number of Signals", "type": "eventCount" } ] } ``` -------------------------------- ### Vue.js Basic Usage with TelemetryDeck SDK Source: https://telemetrydeck.com/docs/guides/vue-setup This snippet demonstrates how to set up and use the TelemetryDeck Vue SDK. It shows how to log events using `signal` and `queue`, change the client user, and includes examples with optional configuration parameters like `testMode`, `clientUser`, and `appID`. ```vue ``` -------------------------------- ### Group By Query Example Source: https://telemetrydeck.com/docs/tql/groupBy This snippet demonstrates how to group events by 'majorSystemVersion' and count them, filtered by a specific 'appID'. Use this for analyzing event distribution across different system versions. ```json { "aggregations": [ { "name": "Number of Signals", "type": "eventCount" } ], "dimensions": [ { "dimension": "majorSystemVersion", "outputName": "Major System Version", "outputType": "STRING", "type": "default" } ], "filter": { "dimension": "appID", "type": "selector", "value": "AAABBBCCC" }, "granularity": "all", "queryType": "groupBy" } ``` -------------------------------- ### Dimension TopNMetricSpec Example Source: https://telemetrydeck.com/docs/tql/topNMetricSpec Sorts top N results by dimension value using lexicographic ordering. 'previousStop' can be used for pagination. ```json "metric": { "type": "dimension", "ordering": "lexicographic", "previousStop": "" } ``` -------------------------------- ### Timeseries Query for User Count per Week Source: https://telemetrydeck.com/docs/tql/query This example timeseries query returns the number of users per week. It requires 'granularity', 'dataSource', and 'queryType'. ```json { "queryType": "timeseries", "granularity": "week", "aggregations": [ { "name": "count", "type": "userCount" } ] } ``` -------------------------------- ### Monthly Retention Query Example Source: https://telemetrydeck.com/docs/tql/retention Analyzes monthly retention over a 3-month period. This query defines the time frame for analyzing user return rates on a monthly basis. ```json { "queryType": "retention", "granularity": "month", relativeIntervals: [ { beginningDate: { component: 'month', offset: -3, position: 'beginning', }, endDate: { component: 'month', offset: 0, position: 'end' }, }, ] } ``` -------------------------------- ### Daily Retention Query Example Source: https://telemetrydeck.com/docs/tql/retention Analyzes daily retention over a 7-day period using the 'telemetry-signals' data source. This is useful for understanding short-term user engagement. ```json { "queryType": "retention", "dataSource": "telemetry-signals", "granularity": "day", relativeIntervals: [ { beginningDate: { component: 'day', offset: -7, position: 'beginning', }, endDate: { component: 'day', offset: 0, position: 'end' }, }, ] } ``` -------------------------------- ### User Information API Response Source: https://telemetrydeck.com/docs/api/api-token Example JSON response when successfully retrieving user information using a valid Personal Access Token. ```json { "email": "you@example.com", "emailIsVerified": true, "firstName": "Daniel", "id": "BADA55-BADGE5", "isFoundingUser": true, "lastName": "Jilg", "organization": { "createdAt": "2020-12-31T23:00:00+0000", "name": "TelemetryDeck", "updatedAt": "2022-07-11T01:27:20+0000" }, "receiveReports": "weekly" } ``` -------------------------------- ### Markdown Formatting Example Source: https://telemetrydeck.com/docs/articles/documentation Illustrates various standard Markdown elements including bold text, italic text, inline code, links, unordered lists, and ordered lists. ```markdown All standard Markdown elements are supported, such as **bold text**, _italic text_, `inline code`, and [links](https://www.markdownguide.org/basic-syntax/#link). - Unordered lists - are just dashes 1. And ordered 1. lists 1. are just numbers ``` -------------------------------- ### Track Feature Exploration Duration Source: https://telemetrydeck.com/docs/articles/duration-events Assess the effectiveness of feature introductions by tracking how long users spend exploring new features. Start the signal upon entering the feature area and stop it upon leaving. ```swift // When user enters new feature area TelemetryDeck.startDurationSignal("Feature.exploration", parameters: [ "featureName": "videoEditor", "entryPoint": entryPoint, ]) // When user leaves the feature area TelemetryDeck.stopAndSendDurationSignal("Feature.exploration", parameters: [ "completedAction": userCreatedVideo ? "true" : "false" ]) ``` -------------------------------- ### Scan Query Example Source: https://telemetrydeck.com/docs/tql/scan This snippet demonstrates the structure of a Scan query. It specifies the query type, desired columns, time interval, a row limit, and the order of results. Use this to retrieve raw event data. ```json { "queryType": "scan", "columns": ["__time", "appID", "type"], "intervals": ["2024-01-01/2024-01-02"], "limit": 3, "order": "descending" } ``` -------------------------------- ### Example Event Structure Source: https://telemetrydeck.com/docs/api/signals-reference This JSON object represents a typical event recorded by TelemetryDeck. It includes event type, app identifier, user identifier, timestamp, and a payload with metadata. ```json { "type": "PlayAction", "appID": "8BADF00D", "clientUser": "C00010FFBAAAAAADDEADFA11", "receivedAt": "2021-04-14T16:41:15+0000", "payload": { "isAppStore": "true", "platform": "iOS", "targetEnvironment": "native", "buildNumber": "2", "isSimulator": "false", "modelName": "iPhone12,1", "operatingSystem": "iOS", "isTestFlight": "false", "appVersion": "3.12.0", "architecture": "arm64", "systemVersion": "iOS 14.4.2" } } ``` -------------------------------- ### Example Retention Query Output Structure Source: https://telemetrydeck.com/docs/tql/retention This JSON structure represents the output of a 3-month retention query, showing aggregated user counts per period and retention intersections between the initial cohort and subsequent periods. ```json { "timestamp": "2024-01-01T00:00:00.000Z", "_2024-01-01_2024-01-31": 5000, "_2024-02-01_2024-02-28": 4200, "_2024-03-01_2024-03-31": 3800, "retention_2024-01-01_2024-01-31_2024-01-01_2024-01-31": 5000, "retention_2024-01-01_2024-01-31_2024-02-01_2024-02-28": 2100, "retention_2024-01-01_2024-01-31_2024-03-01_2024-03-31": 1520 } ``` -------------------------------- ### Logging Errors with Categories in Swift SDK Source: https://telemetrydeck.com/docs/articles/preset-errors Use these examples to log errors with specific categories like thrown exceptions, user input issues, or app state inconsistencies. Ensure the TelemetryDeck SDK is imported. ```swift // Thrown exceptions (parsing errors, I/O errors, permission errors) TelemetryDeck.errorOccurred( id: "FileNotFound", category: .thrownException, message: error.localizedDescription ) // User input errors (invalid format, invalid range) TelemetryDeck.errorOccurred( id: "ProjectForm.hourlyRateConversionFailed", category: .userInput, message: "Text '\(self.textFieldInput)' could not be converted to type 'Int'." ) // App state errors (inconsistent navigation, invalid combinations) TelemetryDeck.errorOccurred( id: "NavigationState.invalidTransition", category: .appState, message: "Cannot navigate from login to dashboard without authentication" ) ``` -------------------------------- ### Filtered Aggregator Example in TQL Source: https://telemetrydeck.com/docs/tql/firstGuideline Use this structure to apply a filter to a specific aggregator, allowing for more complex insights by creating differently filtered buckets. The filter can be an interval or a range, and the aggregator can be userCount, eventCount, or sum types. ```json { "type": "filtered", "filter": { }, "aggregator": { } } ``` -------------------------------- ### Theta Sketch Estimate Post-Aggregator Example Source: https://telemetrydeck.com/docs/tql/post-aggregators Use the thetaSketchEstimate post-aggregator to wrap a theta sketch object for post-aggregations. This example computes the count of users who both launched the app and entered data. ```json { "type": "thetaSketchEstimate", "name": "app_launched_and_data_entered_count", "field": { "type": "thetaSketchSetOp", "name": "app_launched_and_data_entered_count", "func": "INTERSECT", "fields": [ { "type": "fieldAccess", "fieldName": "appLaunchedByNotification_count" }, { "type": "fieldAccess", "fieldName": "dataEntered_count" } ] } } ``` -------------------------------- ### Setup TelemetryDeck Plugin in Vue.js Source: https://telemetrydeck.com/docs/guides/vue-setup Configure and use the TelemetryDeck plugin in your Vue.js application's setup. This includes providing your App ID and optional settings like test mode and client user. ```javascript import TelemetryDeckPlugin from "@peerigon/telemetrydeck-vue"; const app = createApp(App); app.use(TelemetryDeckPlugin, { appID: "{your telemetrydeck appID}", testMode: true, // optional - defaults to false clientUser: "Guest", // optional - defaults to 'Guest' }); app.mount("#app"); ``` -------------------------------- ### Start Sending Signals Source: https://telemetrydeck.com/docs/guides/flutter-setup Restart signal transmission after it has been stopped. This method re-initializes the SDK. ```dart Telemetrydecksdk.start() ``` -------------------------------- ### Numeric TopNMetricSpec Example Source: https://telemetrydeck.com/docs/tql/topNMetricSpec Specifies sorting top N results by a numeric metric, such as 'count'. ```json "metric": { "type": "numeric", "metric": "count" } ``` -------------------------------- ### Define Funnel Stage: dataEntered Source: https://telemetrydeck.com/docs/tql/funnels Example of a selector filter to identify the 'dataEntered' signal type. ```json { "type": "selector", "dimension": "type", "value": "dataEntered" } ``` -------------------------------- ### Define Funnel Stage: appLaunchedByNotification Source: https://telemetrydeck.com/docs/tql/funnels Example of a selector filter to identify the 'appLaunchedByNotification' signal type. ```json { "type": "selector", "dimension": "type", "value": "appLaunchedByNotification" } ``` -------------------------------- ### Inverted TopNMetricSpec Example Source: https://telemetrydeck.com/docs/tql/topNMetricSpec Inverts the sort order of a delegate metric spec, useful for ascending sorts. ```json "metric": { "type": "inverted", "metric": } ``` -------------------------------- ### Initialize TelemetryDeck and Configure RevenueCat Source: https://telemetrydeck.com/docs/integrations/revenuecat Initialize TelemetryDeck with your app ID and salt, update the default user ID, and then configure RevenueCat with your API key and TelemetryDeck user/app IDs. ```swift // 1. // Initialize TelemetryDeck with your app ID let telemetrydeckAppID = "AAAAAAAA-BBBB-CCCC-DDDD" let telemetryDeckConfig = TelemetryDeck.Config( appID: telemetrydeckAppID, salt: "MY_SECRET_SALT" // optional but recommended ) TelemetryDeck.initialize(config: telemetryDeckConfig) // 2. // Manually set a default user for TelemetryDeck // We're using IFV here, but you can also use // e.g. an email address or any other identifying property let myUserID = UIDevice.current .identifierForVendor?.uuidString ?? "unknown user" TelemetryDeck.updateDefaultUserID(to: myUserID) // 3. // Set up RevenueCat with your TelemetryDeck App ID // and the pre-hashed TelemetryDeck User ID Purchases.configure(withAPIKey: "my_revenuecat_api_key") Purchases.shared.attribution.setAttributes([ "$telemetryDeckUserId": TelemetryManager.shared .hashedDefaultUser ?? "no-user", "$telemetryDeckAppId": telemetrydeckAppID ]) ``` -------------------------------- ### Initialize TelemetryDeck SDK in Node.js Source: https://telemetrydeck.com/docs/guides/javascript-setup Initialize the SDK with your app ID and user identifier. Requires a custom crypto implementation for Node.js environments. ```javascript import TelemetryDeck from '@telemetrydeck/sdk'; import crypto from 'crypto'; const td = new TelemetryDeck({ appID: '' clientUser: '', subtleCrypto: crypto.webcrypto.subtle, }); ``` -------------------------------- ### Run Query Source: https://telemetrydeck.com/docs/api/api-run-query Executes a TelemetryDeck Query Language (TQL) query and returns the results. Authentication is required using a personal access token. ```APIDOC ## Run Query ### Description Using the TelemetryDeck API, you can run a query and retrieve its results. ### Authorization You need a personal access token to authenticate against the TelemetryDeck API. Our article Getting a Personal Access Token explains how to generate one from your dashboard. ### TelemetryDeck Query Language TelemetryDeck Query Language (TQL) is a JSON-based language for querying time-series data stored in TelemetryDeck. You can either write a query by hand, or generate a query from an insight. ``` -------------------------------- ### Long Interactions Histogram Split Points Source: https://telemetrydeck.com/docs/articles/duration-events Example of `splitPoints` array for histogram aggregation tailored for long interactions like content consumption. ```json [0, 5, 15, 30, 60, 120, 300, 600, 1200] ``` -------------------------------- ### Medium Interactions Histogram Split Points Source: https://telemetrydeck.com/docs/articles/duration-events Example of `splitPoints` array for histogram aggregation tailored for medium interactions like form fills. ```json [0, 1, 2, 3, 4, 5, 7.5, 10, 15, 20, 30] ``` -------------------------------- ### Document Initial Analysis Results Source: https://telemetrydeck.com/docs/articles/notebooks Record the initial findings from your analysis, including key metrics and insights. This helps in tracking progress and identifying bottlenecks. ```markdown ## Initial results - 80% of users proceed past welcome screen - 55% complete setup step ⚠️ - 80% convert after setup Key Insight: Welcome window isn't the problem. The real bottleneck is the setup step. ``` -------------------------------- ### Short Interactions Histogram Split Points Source: https://telemetrydeck.com/docs/articles/duration-events Example of `splitPoints` array for histogram aggregation tailored for short interactions like button clicks. ```json [0, 0.05, 0.1, 0.15, 0.2, 0.3, 0.5, 1, 2, 5] ``` -------------------------------- ### Manual Purchase Signal Implementation (Swift) Source: https://telemetrydeck.com/docs/articles/preset-purchases This Swift code demonstrates how to manually construct and send a purchase completion signal to TelemetryDeck. It includes required fields like event name and purchase amount, along with optional but recommended payload keys for detailed insights. ```swift // Convert price to USD first (you need to handle currency conversion) let priceInUSD = convertToUSD(transaction.price, from: transaction.currencyCode) TelemetryDeck.signal( "TelemetryDeck.Purchase.completed", parameters: [ "TelemetryDeck.Purchase.type": transaction.subscriptionGroupID != nil ? "subscription" : "one-time-purchase", "TelemetryDeck.Purchase.countryCode": transaction.storefrontCountryCode, "TelemetryDeck.Purchase.currencyCode": transaction.currencyCode ?? "???" ], floatValue: priceInUSD ) ``` -------------------------------- ### Track Onboarding Step Duration Source: https://telemetrydeck.com/docs/articles/duration-events Use `startDurationSignal` and `stopAndSendDurationSignal` to track time spent in each step of an onboarding flow. Parameters can be added when stopping the signal. ```swift // In first onboarding screen TelemetryDeck.startDurationSignal("Onboarding.step1") // When moving to second screen TelemetryDeck.stopAndSendDurationSignal("Onboarding.step1", parameters: ["pushAccess": "granted"]) TelemetryDeck.startDurationSignal("Onboarding.step2") ``` -------------------------------- ### Initialize TelemetryClient in Flutter Source: https://telemetrydeck.com/docs/guides/flutter-setup Initialize the TelemetryClient by calling the start method with your App ID. Ensure platform channels are initialized before calling runApp. ```dart void main() { // ensure the platform channels are available WidgetsFlutterBinding.ensureInitialized(); // configure and start the client Telemetrydecksdk.start( const TelemetryManagerConfiguration( appID: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", ), ); runApp(const MyApp()); } ``` -------------------------------- ### POST /api/v4/query/tql Source: https://telemetrydeck.com/docs/api/api-run-query Runs a TQL query and returns the results. Query execution can take up to 2 minutes for complex requests. ```APIDOC ## POST /api/v4/query/tql ### Description Runs a TQL query and returns the results. Query execution can take up to 2 minutes for complex requests. ### Method POST ### Endpoint /api/v4/query/tql ### Request Body - **aggregations** (array) - Required - Defines the aggregations to perform on the query results. - **dataSource** (string) - Required - The identifier for the data source. - **dimension** (object) - Optional - Specifies the dimension for grouping results. - **filter** (object) - Optional - Filters to apply to the query. - **granularity** (string) - Optional - The granularity of the results (e.g., 'all'). - **metric** (object) - Optional - Specifies the metric to calculate. - **queryType** (string) - Required - The type of query to run (e.g., 'topN'). - **relativeIntervals** (array) - Optional - Time intervals for the query. - **threshold** (number) - Optional - A threshold value for certain query types. ### Request Example ```json { "aggregations": [ { "type": "eventCount" } ], "dataSource": "com.yourorganization", "dimension": { "dimension": "modelName", "outputName": "modelName", "type": "default" }, "filter": { "fields": [ { "dimension": "appID", "type": "selector", "value": "B97579B6-FFB8-4AC5-AAA7-DA5796CC5DCE" }, { "dimension": "isTestMode", "type": "selector", "value": "false" } ], "type": "and" }, "granularity": "all", "metric": { "metric": "count", "type": "numeric" }, "queryType": "topN", "relativeIntervals": [ { "beginningDate": { "component": "day", "offset": -30, "position": "beginning" }, "endDate": { "component": "day", "offset": 0, "position": "end" } } ], "threshold": 200 } ``` ### Response #### Success Response (200) - **calculationDuration** (number) - The time taken to execute the query in seconds. - **calculationFinishedAt** (string) - The timestamp when the query execution finished. - **result** (object) - The results of the query. - **rows** (array) - An array of result rows. - **type** (string) - The type of the result (e.g., 'topNResult'). #### Response Example ```json { "calculationDuration": 0.21845901012420654, "calculationFinishedAt": "2022-07-11T14:00:44+0000", "result": { "rows": [ { "result": [ { "count": 516, "modelName": "iPhone13,1" }, { "count": 2, "modelName": "iPad8,6" } ], "timestamp": "2022-06-11T00:00:00+0000" } ], "type": "topNResult" } } ``` ``` -------------------------------- ### Initialize TelemetryDeck in Single Line (SwiftUI) Source: https://telemetrydeck.com/docs/guides/swift-setup A more concise way to initialize TelemetryDeck within your SwiftUI application's @main App struct. ```swift TelemetryDeck.initialize(config: .init(appID: "YOUR-APP-ID")) ``` -------------------------------- ### Event Count Aggregator Source: https://telemetrydeck.com/docs/tql/aggregators Computes the total number of TelemetryDeck events within a query. Use this to get a raw count of all recorded events. ```json { "type" : "eventCount", "name" : } ``` -------------------------------- ### Define Funnel Stage: Specific Event Action Source: https://telemetrydeck.com/docs/tql/funnels Example of an 'and' filter to identify a specific event type ('event') with a particular action ('watchNow'). ```json { "type": "and", "fields": [ { "type": "selector", "dimension": "type", "value": "event" }, { "type": "selector", "dimension": "action_id", "value": "watchNow" } ] } ``` -------------------------------- ### Example Absolute Time Interval Source: https://telemetrydeck.com/docs/tql/time-intervals Specifies an absolute time interval using two ISO-8601 timestamps. This is useful for querying a fixed historical period. ```string "2012-01-01T00:00:00.000/2012-01-03T00:00:00.000" ``` -------------------------------- ### Basic Document Metadata Source: https://telemetrydeck.com/docs/articles/documentation This YAML frontmatter includes the required 'title' and 'lead' fields for a documentation page. ```yaml --- title: How to write this Documentation lead: The TelemetryDeck documentation lives in a public GitHub repository. Here's how to contribute. --- ``` -------------------------------- ### Run TQL Query Source: https://telemetrydeck.com/docs/api/api-run-query Send a POST request to the `/api/v4/query/tql` endpoint with your TQL query in JSON format. The response includes the query results and execution duration. Ensure you include the correct Authorization header. ```http POST /api/v4/query/tql HTTP/1.1 Authorization: Bearer tdpat_… Content-Type: application/json Host: api.telemetrydeckapi.com { "aggregations": [ { "type": "eventCount" } ], "dataSource": "com.yourorganization", "dimension": { "dimension": "modelName", "outputName": "modelName", "type": "default" }, "filter": { "fields": [ { "dimension": "appID", "type": "selector", "value": "B97579B6-FFB8-4AC5-AAA7-DA5796CC5DCE" }, { "dimension": "isTestMode", "type": "selector", "value": "false" } ], "type": "and" }, "granularity": "all", "metric": { "metric": "count", "type": "numeric" }, "queryType": "topN", "relativeIntervals": [ { "beginningDate": { "component": "day", "offset": -30, "position": "beginning" }, "endDate": { "component": "day", "offset": 0, "position": "end" } } ], "threshold": 200 } ``` -------------------------------- ### Register Superwall Delegate Source: https://telemetrydeck.com/docs/integrations/superwall Initialize the Superwall delegate and register it with Superwall. This code should be placed after initializing both TelemetryDeck and Superwall. ```swift let superwallService = SuperwallService() Superwall.shared.delegate = superwallService ``` -------------------------------- ### Add TQL Query to Notebook Source: https://telemetrydeck.com/docs/articles/notebooks Paste your TQL query into the notebook to create a funnel chart. This section is a placeholder for the actual query. ```markdown ## User journey analysis Let's track the complete user journey from installation to first successful value delivery: ```