Skip to content

Instantly share code, notes, and snippets.

export default function createTracker(config, context) {
function addContext(data) {
const newContext = {...data, _parent: context};
return createTracker(config, newContext);
}
function trackEvent(eventName, payload) {
// Custom logic for your analytics backend.
console.log(`tracking event ${eventName}`, {...payload, _parent: context});
}

There are 2 approaches we can take to support Analytics in TDS.

  1. TDS components have no idea of that there is any analytics going on.
  2. TDS components are capable of emitting analytics events to component, given a well known named hook (i.e. a prop).

Both these approaches have pros and cons. Which I will briefly discuss below, along with code samples. Please take some time to think about these approaches. There's no TLDR! Also, its a long writeup. Please forgive the typos and let me know so I can fix them. I am hoping we can get on a call and discuss this proposal.

nav: [
{title: 'Account', href: '/guides/account'}
]
resources: {
'account': {
'x-sfdc-ia-resource': 'Account',
paths : {
'/AccountList': {
'get': {
@rsukale
rsukale / guide_classes.rb
Created February 23, 2017 00:47
guide_classes
module GuidesHelper
def guides_list_props
dummyItem = {
url: 'foobar.com',
version: {
locale: 'en',
date: '2012-02-02',
firstVersion: 'v1.0',
currentVersion: 'v1.3'
},
/* global createStateDispatcher */
/* exported adminContentsDispatcher, adminContents$ */
// ---|------|
const adminRecords$ = createStateDispatcher(stream,{
load: {
subject: something,
reducer(state, payload) {