From 1a28ad66a6af2301e30f22491882930b168c94ce Mon Sep 17 00:00:00 2001 From: Bob Evans Date: Tue, 14 Apr 2015 15:52:54 -0400 Subject: [PATCH] removed defaulting open/click tracking to true --- README.md | 4 ++-- examples/transmission/mime_parts.js | 4 +++- examples/transmission/send_transmission_all_fields.js | 4 ++-- lib/transmission.js | 4 ++-- test/spec/transmissions.spec.js | 8 ++++---- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d530abc..7de1974 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,8 @@ sparkpost.transmission.send(trans, function(err, res) { | campaign | no | Field for assigning a given transmission to a specific campaign, which is a logical container for similar transmissions | String | | metadata | no | Field for adding arbitrary key/value pairs which will be included in open/click tracking | Object (Simple) | | substitutionData | no | Field for adding transmission level substitution data, which can be used in a variety of fields and in content | Object (Complex) | -| trackOpens | no | Field for enabling/disabling transmission level open tracking (default: true) | Boolean | -| trackClicks | no | Field for enabling/disabling transmission level click tracking (default: true) | Boolean | +| trackOpens | no | Field for enabling/disabling transmission level open tracking, if not set will use settings from Template | Boolean | +| trackClicks | no | Field for enabling/disabling transmission level click tracking, if not set will use settings from Template | Boolean | | useSandbox | no | Field for enabling/disabling using sandbox domain to send transmission(You are limited to 50 messages ever with sandbox) | Boolean | | useDraftTemplate | no | Field for allowing the sending of a transmission using a draft of a stored template (default: false) | Boolean | | replyTo | no | Field for specifying the email address that should be used when a recipient hits the reply button | String | diff --git a/examples/transmission/mime_parts.js b/examples/transmission/mime_parts.js index 6c0d295..9ea0dff 100644 --- a/examples/transmission/mime_parts.js +++ b/examples/transmission/mime_parts.js @@ -8,7 +8,9 @@ var trans = { recipients: [{ address: { email: 'john.doe@example.com' } }], subject: 'Example Email for MIME Parts', html: '

Hello World!

', - text: 'Hello World!' + text: 'Hello World!', + trackOpens: true, + trackClicks: true }; sparkpost.transmission.send(trans, function(err, res) { diff --git a/examples/transmission/send_transmission_all_fields.js b/examples/transmission/send_transmission_all_fields.js index c418dc3..3bfc43b 100644 --- a/examples/transmission/send_transmission_all_fields.js +++ b/examples/transmission/send_transmission_all_fields.js @@ -17,8 +17,8 @@ var trans = { customHeaders: { 'X-Custom-Header': 'Sample Custom Header' }, - trackOpens: false, - trackClicks: false, + trackOpens: true, + trackClicks: true, useSandbox: true, useDraftTemplate: true, from: 'From Envelope ', diff --git a/lib/transmission.js b/lib/transmission.js index 7911a17..c2900f5 100644 --- a/lib/transmission.js +++ b/lib/transmission.js @@ -27,8 +27,8 @@ var toApiFormat = function(input) { model.metadata = input.metadata; model.substitution_data = input.substitutionData; - model.options.open_tracking = input.trackOpens === false ? false : true; - model.options.click_tracking = input.trackClicks === false ? false : true; + model.options.open_tracking = input.trackOpens; + model.options.click_tracking = input.trackClicks; model.options.sandbox = input.useSandbox; model.content.use_draft_template = input.useDraftTemplate || false; diff --git a/test/spec/transmissions.spec.js b/test/spec/transmissions.spec.js index 97addde..844a4f9 100644 --- a/test/spec/transmissions.spec.js +++ b/test/spec/transmissions.spec.js @@ -48,14 +48,14 @@ describe('Transmissions Library', function() { }); }); - it('should default open and click tracking', function() { + it('should default open and click tracking to be undefined', function() { transmission.send({}, function(err, res) { - expect(sendSpy.args[0][0].json.options.open_tracking).to.be.true; - expect(sendSpy.args[0][0].json.options.click_tracking).to.be.true; + expect(sendSpy.args[0][0].json.options.open_tracking).to.be.undefined; + expect(sendSpy.args[0][0].json.options.click_tracking).to.be.undefined; }); }); - it('should allow a user to override open and click tracking', function() { + it('should allow a user to set open/click tracking', function() { transmission.send({trackOpens: false, trackClicks: false}, function(err, res) { expect(sendSpy.args[0][0].json.options.open_tracking).to.be.false; expect(sendSpy.args[0][0].json.options.click_tracking).to.be.false;