Skip to content

Context is everything

Compare
Choose a tag to compare
@poteto poteto released this 17 Sep 14:51
· 656 commits to master since this release

This release adds the ability to include context to each service call. For example, you might want to include certain information about the user that is triggering the event or page view. You can now specify a context object on the Metrics service itself, that will be included across all calls.

For example:

const currentUserName = Ember.get(this, 'currentUser.fullName'); // 'Derek Zoolander'
Ember.set(this, 'metrics.context.userName', currentUserName);
Ember.get(this, 'metrics').trackPage({ page: 'page/1' }); // { userName: 'Derek Zoolander', page: 'page/1' }

Thanks to @opsb for implementing this feature.