I have an extension that removes rouge applications from a users news feed on Facebook.
Within the extensions JS I programatically include a <script>
tag which is used for stats tracking. Basically to see how many people are using the application, from what countries etc.
The problem is when the user is on Facebook, the tracking script will only load once. And as the user is browsing Facebook it won't load again unless they manually refresh the page.
Here is my code inside my content script.
$(document).ready(function() {
// Include stats tracking
(function(d){
var trackingjs, id = 'stats'; if (d.getElementById(id)) {return;}
trackingjs = d.createElement('script'); trackingjs.id = id; trackingjs.async = true;
trackingjs.src = "tracking_url";
d.getElementsByTagName('body')[0].appendChild(trackingjs);
}(document));
}
I include the jQuery because I use jQuery for my plugin. Everything works fine except it only includes this script once and won't include it again unless the user manually refreshes the page.
Is this something to do with Facebook?