File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ var protocol = require('segmentio/protocol');
1313var send = require ( 'yields/send-json' ) ;
1414var topDomain = require ( 'top-domain' ) ;
1515var uuid = require ( 'uuid' ) ;
16+ var encode = require ( 'ForbesLindesay/base64-encode' ) ;
1617
1718/**
1819 * Cookie options
@@ -166,9 +167,20 @@ Attribution.prototype.normalize = function(msg) {
166167 */
167168
168169Attribution . prototype . send = function ( path , msg , fn ) {
169- var projectId = this . options . project || window . Attribution . projectId ;
170- var url = scheme ( ) + '//track.attributionapp.com' + path + "?project_id=" + projectId ;
171- var headers = { 'Content-Type' : 'text/plain' } ;
170+ var url = scheme ( ) + '//track.attributionapp.com' + path ;
171+
172+ var username = this . options . project || window . Attribution . projectId ;
173+ var password = "" ;
174+ var basicAuth = 'Basic ' + encode ( username + ":" + password ) ;
175+
176+ var headers = {
177+ 'Content-Type' : 'text/plain' ,
178+ 'Authorization' : basicAuth
179+ } ;
180+
181+ // No headers on JSONP so put the project_id in the msg
182+ msg . project_id = username ;
183+
172184 fn = fn || noop ;
173185 var self = this ;
174186
You can’t perform that action at this time.
0 commit comments