-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Draft] Best Practices Guide: Sending Data to External Destinations #694
Draft
katemacfarlane
wants to merge
4
commits into
main
Choose a base branch
from
docs-piping-dvc-data-to-external-destinations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ab1dc9b
Sending Data to External Destinations Best Practices Guide
katemacfarlane 7d84d41
Merge branch 'main' into docs-piping-dvc-data-to-external-destinations
andrewdmaclean a0c84fc
Merge branch 'main' into docs-piping-dvc-data-to-external-destinations
andrewdmaclean c0f7719
Merge branch 'main' into docs-piping-dvc-data-to-external-destinations
andrewdmaclean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
docs/best-practices/send-dvc-data-external-destinations.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--- | ||
title: Sending DevCycle Data to External Destinations | ||
sidebar_label: Sending Data to External Destinations | ||
sidebar_position: 11 | ||
description: How to send DevCycle Feature data to external destinations such as CDPs, analytics providers, etc. | ||
sidebar_custom_props: { icon: carbon:data-vis-1 } | ||
--- | ||
|
||
# Sending DevCycle Data to External Destinations | ||
|
||
This topic explains how to send Feature and/or experimentation data to external destinations. | ||
|
||
Some of our users prefer to use their own data warehouse and tools to analyze Feature and experiment data. Given this need, DevCycle provides ways to pipe data to any location of your choice. | ||
|
||
In this guide, we provide code examples for the Node.js, Javascript, Android, and iOS SDKs on how to pull Experiment and Variation information from the DevCycle SDK for a given user and pass it to an example data analytics platform, such as Adobe. | ||
|
||
While the specifics differ slightly between SDKs, the concept is largely the same. DevCycle has a method called `getAllFeatures` which provides a JSON map of the Features (Experiments) and Variations that a user received. This map can then be passed to an analytics provider in whatever format or context is desired. While the details below provide code specific to each SDK, the general documentation for the `getAllFeatures` method can be found [here](/sdk/features#getting-all-features). | ||
|
||
The format of the `getAllFeatures` response looks like this: | ||
|
||
```json | ||
{ | ||
"your-cool-feature": { | ||
"_id": "123456", | ||
"key": "your-cool-feature", | ||
"type": "release", | ||
"_variation": "333345", | ||
"variationName": "Some Variation", | ||
"variationKey": "some-variation" | ||
}, | ||
"an-experiment": { | ||
"_id": "234567", | ||
"key": "an-experiment", | ||
"type": "experiment", | ||
"_variation": "444123", | ||
"variationName": "Treatment", | ||
"variationKey": "treatment" | ||
} | ||
} | ||
``` | ||
Given DevCycle may be used for experimentation, feature flagging and remote configuration, the “type” field in the response can be used to either filter or augment the data that is being sent to your chosen destination. | ||
|
||
**Note**: The details specific to your analytics destination should be reviewed and verified by your team to ensure the accuracy and desired format of the data. | ||
|
||
|
||
## Code Examples for Adobe | ||
|
||
|
||
### DevCycle Code for Node.js | ||
|
||
```javascript | ||
const user = { user_id: '123' } | ||
const features = devcycleClient.allFeatures(user); | ||
const variations = {}; | ||
Object.values(features).forEach((feature) => { | ||
variations[feature.key] = feature.variationName; | ||
}) | ||
Analytics.trackAction("DVC_Features", variations); | ||
``` | ||
|
||
Link to [Node.js Documentation](/sdk/server-side-sdks/node/node-usage#getting-all-features) | ||
|
||
### DevCycle Code for Javascript | ||
|
||
```javascript | ||
const features = devcycleClient.allFeatures(); | ||
let variations = []; | ||
Object.values(features).forEach((feature) => { | ||
variations.push(`${feature.key}:${feature.variationName}`); | ||
}) | ||
omtr.eVarNumber = variations.join(','); | ||
``` | ||
Link to [Javascript Documentation](/sdk/client-side-sdks/javascript/javascript-usage#get-all-features) | ||
|
||
### DevCycle Code for Android (Java) | ||
|
||
```java | ||
import com.devcycle.sdk.android.model.Feature; | ||
|
||
HashMap<String, String> variations = new HashMap<>(); | ||
Map<String, Feature> features = devcycleClient.allFeatures(); | ||
for (Feature feature : features.values()) { | ||
variations.put(feature.getKey(), feature.getVariationName()); | ||
} | ||
|
||
Analytics.trackAction("DVC_Features", variations); | ||
``` | ||
Link to [Android Documentation](/sdk/client-side-sdks/android/android-usage#java-example-3) | ||
|
||
### DevCycle Code for iOS (Swift) | ||
|
||
```swift | ||
var variations: [String: String] = [:] | ||
let features: [String: Feature] = self.devcycleClient!.allFeatures() | ||
for featurekey in features.keys { | ||
let variation = features[featurekey]?.variationName | ||
variations[featurekey] = variation | ||
} | ||
|
||
MobileCore.track(action: "DVC_Features", data: variations) | ||
``` | ||
Link to [iOS Documentation](/sdk/client-side-sdks/ios/ios-usage#get-all-features) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats omtr?