I'm trying to load Twitter's tracking pixel on my Meteor/NodeJS website.
The code they provide is:
!(function(e, t, n, s, u, a) {
e.twq ||
((s = e.twq = function() {
s.exe ? s.exe.apply(s, arguments) : s.queue.push(arguments);
}),
(s.version = "1.1"),
(s.queue = []),
(u = t.createElement(n)),
(u.async = !0),
(u.src = "//static.ads-twitter.com/uwt.js"),
(document.body.appendChild(u)));
})(window, document, "script");
twq("init", "MY-TRACKING-ID");
twq("track", "PageView");
It loads fine but returns the following error in the console:
Refused to execute script from 'https://analytics.twitter.com/i/adsct?p_id=Twitter...' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
This is the exact same problem as: https://twittercommunity.com/t/analytics-tracking-pixel-error-was-blocked-due-to-mime-type-mismatch-x-content-type-options-nosniff/83583/2, but while that thread is unresolved he's running the Twitter tracking pixel on that site now, which suggests it's a server configuration issue.
Looking at the code, this uwt.js file from Twitter it requests a script from https://analytics.twitter.com/i/adsct which Chrome is preventing from running.
This answer suggests it's either a MIME type config issue (I'm running Nginx) or a header issue, but removing X-Content-Type-Options: nosniff and restarting Nginx had no effect.
Any idea how to fix or better troubleshoot this?
ewithin the function? – guest271314 Sep 29 '17 at 16:53