Skip to content

Commit 8329cf7

Browse files
committed
Use hostname from parameter
1 parent f2f489b commit 8329cf7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/stats.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
require('es6-promise').polyfill();
44
require('isomorphic-fetch');
55

6-
var sendStats = function(sitekey, data) {
6+
var sendStats = function(apiHostname, sitekey, data) {
77

88
// Beacon in browsers
99
if (typeof window !== 'undefined' && window.navigator && window.navigator.sendBeacon) {
10-
navigator.sendBeacon('https://api.addsearch.com/v1/stats/' + sitekey + '/', JSON.stringify(data));
10+
navigator.sendBeacon('https://' + apiHostname + '/v1/stats/' + sitekey + '/', JSON.stringify(data));
1111
}
1212

1313
// POST in node
1414
else {
15-
fetch('https://api.addsearch.com/v1/stats/' + sitekey + '/', {
15+
fetch('https://' + apiHostname + '/v1/stats/' + sitekey + '/', {
1616
method: 'POST',
1717
headers: {
1818
'Content-Type': 'text/plain',

0 commit comments

Comments
 (0)