TelemetryDeck / docs

Public Documentation for TelemetryDeck
https://telemetrydeck.com/docs
5 stars 8 forks source link

Test Mode: How it works, what it does, how to send signals in test mode #31

Closed winsmith closed 1 year ago

winsmith commented 2 years ago

Reason

Tags

How it works

How to send signals in test mode

Manually set Test Mode in Swift SDK

// An example variable to manually set test mode.
// Set this to `true` or `false` depending on your app's configuration
// or environment or state
let customTestModeParameter = true

TelemetryManager.send(
    "pizzaModeActivated",
    for: "myUserIdentifier",
    with: ["isTestMode": customTestModeParameter ? "true" : "false"]
)

Manually set test mode in JavaScript SDK

// Example initialisation of TelemetryDeck SDK
td = new TelemetryDeck({
  app: ENV.APP.telemetryAppID,
  user: this.user.current?.email ?? 'anonymous',
});

// In our example, the app has a `send` function wrapping the TelemetryDeck SDK
send(payload) {
  // ENV.APP.telemetryIsDebug is an example variable that represents your app's
  // configuration or environment. Replace it with an implementation that fits your
  // app's needs.
  if (ENV.APP.telemetryIsDebug) {
    this.td.signal({...payload, isTestMode: "true"})
    return;
  }

  this.td.signal(payload);
}
winsmith commented 2 years ago

@voidedmain I've updated the ticket with a bit more information -- sorry for the delay. Let me know if you have any questions about the content!

winsmith commented 2 years ago

Just realised there is already an article on test mode: articles/test-mode.md! I think we should update that article instead of writing a new one

voidedmain commented 2 years ago

Thanks for letting me know! Will have a look at it as soon as possible.