From 844a7f5c241cff7d07b1723f8ad69bca2dab2286 Mon Sep 17 00:00:00 2001 From: Josh Wymer Date: Thu, 3 Mar 2022 19:54:46 -0600 Subject: [PATCH 1/2] add ability to specify strict mode using config --- lib/mixpanel-node.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/mixpanel-node.js b/lib/mixpanel-node.js index adac3f5..4986925 100644 --- a/lib/mixpanel-node.js +++ b/lib/mixpanel-node.js @@ -111,6 +111,10 @@ var create_client = function(token, config) { query_params.test = 1; } + if (metrics.config.strict) { + query_params.strict = 1; + } + request_options.path = metrics.config.path + endpoint + "?" + querystring.stringify(query_params); request = request_lib.request(request_options, function(res) { From b61363bafc49cfabbf2774186781c6c0d2aac26d Mon Sep 17 00:00:00 2001 From: Josh Wymer Date: Thu, 3 Mar 2022 19:57:49 -0600 Subject: [PATCH 2/2] update docs to use strict mode --- example.js | 2 +- readme.md | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/example.js b/example.js index 87f9396..adfbb72 100644 --- a/example.js +++ b/example.js @@ -3,7 +3,7 @@ var Mixpanel = require('./lib/mixpanel-node'); // create an instance of the mixpanel client var mixpanel = Mixpanel.init('962dbca1bbc54701d402c94d65b4a20e'); -mixpanel.set_config({ debug: true }); +mixpanel.set_config({ debug: true, strict: true }); // track an event with optional properties mixpanel.track("my event", { diff --git a/readme.md b/readme.md index c47e926..e509d8f 100644 --- a/readme.md +++ b/readme.md @@ -18,11 +18,12 @@ Quick Start var Mixpanel = require('mixpanel'); // create an instance of the mixpanel client -var mixpanel = Mixpanel.init(''); +var mixpanel = Mixpanel.init('', {strict: true}); // initialize mixpanel client configured to communicate over https var mixpanel = Mixpanel.init('', { - protocol: 'https' + protocol: 'https', + strict: true, }); // track an event with optional properties