Skip to content

Instantly share code, notes, and snippets.

@timhudson
Last active March 14, 2017 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timhudson/edfd7f169c39608ffa99f4a1d03759c4 to your computer and use it in GitHub Desktop.
Save timhudson/edfd7f169c39608ffa99f4a1d03759c4 to your computer and use it in GitHub Desktop.
Analytics.ql
const query = `
query ($workspaceSlug: String, $sourceSlug: String) {
segment {
workspace(slug: $workspaceSlug) {
id
}
source(slug: $sourceSlug) {
id
}
}
}
`
const mapping = {
workspace_id: 'segment.workspace.id',
source_id: 'segment.source.id'
}
async analyticsQl(query, mapping).track('Source Viewed', {
workspaceSlug: "some-workspace"
sourceSlug: "some-source"
})
@benjaminhoffman
Copy link

nice. can this be used in prod?

@timhudson
Copy link
Author

It's just an idea right now. Trying to simplify enrichment when tracking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment