diff --git a/README.md b/README.md index 8551cd59..e6149a14 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Writing your own adapters for currently unsupported analytics services is easy t 1. `Mixpanel` - `token`: [Mixpanel token](https://mixpanel.com/help/questions/articles/where-can-i-find-my-project-token) + - Optionally other [config options to override](https://developer.mixpanel.com/docs/javascript-full-api-reference#mixpanelinit) 1. `GoogleTagManager` - `id`: [Container ID](https://developers.google.com/tag-manager/quickstart), e.g. `GTM-XXXX` diff --git a/addon/metrics-adapters/mixpanel.js b/addon/metrics-adapters/mixpanel.js index 6cc7c414..7affaabc 100644 --- a/addon/metrics-adapters/mixpanel.js +++ b/addon/metrics-adapters/mixpanel.js @@ -10,7 +10,9 @@ export default class Mixpanel extends BaseAdapter { } init() { - const { token } = this.config; + const config = assign({ batch_requests: true }, this.config); + const { token } = config; + delete config.token; assert(`[ember-metrics] You must pass a valid \`token\` to the ${this.toString()} adapter`, token); @@ -19,7 +21,7 @@ export default class Mixpanel extends BaseAdapter { 0)))}}var e=a;"undefined"!==typeof g?e=a[g]=[]:g="mixpanel";e.people=e.people||[];e.toString=function(b){var a="mixpanel";"mixpanel"!==g&&(a+="."+g);b||(a+=" (stub)");return a};e.people.toString=function(){return e.toString(1)+".people (stub)"};l="disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(" "); for(h=0;h { + return true; + }); + adapter.init(); + + assert.ok( + init_stub.firstCall.calledWith(config.token, { + secure_cookie: true, + batch_requests: false, + }), + "it sends the correct config options" + ); + }); });