Skip to content

Commit 7fde081

Browse files
snapwichNate Cozi
authored and
Nate Cozi
committed
remove old adloader#trackPixel (#1159)
1 parent 2652fc0 commit 7fde081

File tree

2 files changed

+0
-56
lines changed

2 files changed

+0
-56
lines changed

src/adloader.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,3 @@ function requestResource(tagSrc, callback) {
8383
elToAppend.insertBefore(jptScript, elToAppend.firstChild);
8484
}
8585
}
86-
87-
//track a impbus tracking pixel
88-
//TODO: Decide if tracking via AJAX is sufficent, or do we need to
89-
//run impression trackers via page pixels?
90-
exports.trackPixel = function (pixelUrl) {
91-
let delimiter;
92-
let trackingPixel;
93-
94-
if (!pixelUrl || typeof (pixelUrl) !== 'string') {
95-
utils.logMessage('Missing or invalid pixelUrl.');
96-
return;
97-
}
98-
99-
delimiter = pixelUrl.indexOf('?') > 0 ? '&' : '?';
100-
101-
//add a cachebuster so we don't end up dropping any impressions
102-
trackingPixel = pixelUrl + delimiter + 'rnd=' + Math.floor(Math.random() * 1E7);
103-
(new Image()).src = trackingPixel;
104-
return trackingPixel;
105-
};

test/spec/adloader_spec.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,4 @@
11
describe('adLoader', function () {
22
var assert = require('chai').assert,
33
adLoader = require('../../src/adloader');
4-
5-
describe('trackPixel', function () {
6-
it('correctly appends a cachebuster query paramter to a pixel with no existing parameters', function () {
7-
var inputUrl = 'http://www.example.com/tracking_pixel',
8-
token = '?rnd=',
9-
expectedPartialUrl = inputUrl + token,
10-
actual = adLoader.trackPixel(inputUrl),
11-
actualPartialUrl = actual.split(token)[0] + token,
12-
randomNumber = parseInt(actual.split(token)[1]);
13-
assert.strictEqual(actualPartialUrl, expectedPartialUrl);
14-
assert.isNumber(randomNumber);
15-
});
16-
});
17-
18-
it('correctly appends a cachebuster query paramter to a pixel with one existing parameter', function () {
19-
var inputUrl = 'http://www.example.com/tracking_pixel?food=bard',
20-
token = '&rnd=',
21-
expectedPartialUrl = inputUrl + token,
22-
actual = adLoader.trackPixel(inputUrl),
23-
actualPartialUrl = actual.split(token)[0] + token,
24-
randomNumber = parseInt(actual.split(token)[1]);
25-
assert.strictEqual(actualPartialUrl, expectedPartialUrl);
26-
assert.isNumber(randomNumber);
27-
});
28-
29-
it('correctly appends a cachebuster query paramter to a pixel with multiple existing parameters', function () {
30-
var inputUrl = 'http://www.example.com/tracking_pixel?food=bard&zing=zang',
31-
token = '&rnd=',
32-
expectedPartialUrl = inputUrl + token,
33-
actual = adLoader.trackPixel(inputUrl),
34-
actualPartialUrl = actual.split(token)[0] + token,
35-
randomNumber = parseInt(actual.split(token)[1]);
36-
assert.strictEqual(actualPartialUrl, expectedPartialUrl);
37-
assert.isNumber(randomNumber);
38-
});
39-
404
});

0 commit comments

Comments
 (0)