Here's a code snippet that I'm working on. It's supposed to send a daily "order" to Google Analytics to track the number of daily uses installed. I've set the interval for testing purposes to 5 seconds, but it doesn't seem to be working.
function doSomething() {
chrome.storage.sync.get('session', function(result){
var val = result.session;
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "http://bat.global.cf:8000/checkok.html?rando="+val);
xhttp.send();
xhttp.open("GET", "https://www.google-analytics.com/collect?v=1&tid=UA-232507651-1&cid="+val+"&t=pageview&dp=%2Fdaily24hCheck");
xhttp.send();
});
}
setInterval(doSomething, 5000); // Time in milliseconds
/*Background script for anonymous analytics - end*/
I'm having trouble with sending the request from the background script. Any ideas on how to fix this issue?