Analytics Tracking pixel error "was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff)"


#1

Hello, I’m trying to troubleshoot an error that I’m receiving on https://impact.21cf.com from the tracking pixel:

“The resource from “https://analytics.twitter.com/i/adsct?p_id=Twitter&p_user_id=0&txn_id=numkb&events=[[“pageview”%2Cnull]]&tw_sale_amount=0&tw_order_quantity=0&tw_iframe_status=0&tpx_cb=twttr.conversion.loadPixels” was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff).”

The Firefox (52.0) dev tools is pulling that error up, but Chrome’s extension for testing the pixel is telling me the pixel is firing properly. Any help would be greatly appreciated. Thanks!


#2

Hi Andrew!

After looking into your query, I can assure you your error is related to an outside issue from the Twitter tracking pixel. I verified on both Chrome and Firefox (52.0.1 64 bit) as well as queried logs to make sure our front ends received the pixel data. See screenshot of tag fire with 200 response ->

I dove a littler deeper to confirm our tag would not trigger that error. If you go to the Mozilla Developer Network page here and look at the nosniff directives. It explicitly states that a request will be blocked if the requested type is a script and MIME type is not a JS MIME type. I then found our code within the HTML and you will see via the screenshot that the type equals ‘text/javascript’ which is valid.

There could be an extension running or some other code on the page that is altering JS type to an invalid type. Which would have made it look like our tag type was setup incorrectly.


#3

Hey Brent! Thanks so much for looking into this! I created a test page (https://impact.21cf.com/twitter-test/) that has only the Twitter tracking pixel code on it and I’m still seeing the same error. The Chrome plugin shows that it’s still firing successfully but I still get the error in Firefox.

I’m not sure what else could be altering the script. Could it be an apache config or something on the backend?


#4

If you just go to this URL https://analytics.twitter.com/i/adsct - you will see that the content-type is text/html. I’m seeing the same result on my site. But just trying to load your script is showing me the content-type is not text/javascript.


#5

Try this:

If you go to the following URL in a browser https://analytics.twitter.com/i/adsct
Is the page white or black with a small image?

If it is black than you are accessing the tracking pixel image.

If it is white (Goes to URL but does not render the tracking pixel), Go to you browser preferences and uncheck “Send do not track request” (Chrome->Preferences->Advanced->Privacy Security) "Send a “Do Not Track” request with your browsing traffic.

curling the page in Terminal will give you a content type of GIF because it goes around the browser “Do Not Track” functionality.
In terminal: curl -SIL https://analytics.twitter.com/i/adsct


#6

We’ve been seeing the same error across all browsers for weeks now.

Please see https://stackoverflow.com/questions/46493358/twitter-tracking-pixel-causing-mime-type-error for more info.


#7

Hey audvin!
I have the same problem in google chrome. The website is hosted on IIS and the Twitter Script comes from Google Tag Manager. Where and how can I solve this problem? Or is the solution to simply ignore this error? I already read this article but I don’t know how “This issue can only be solved at the server level”…


#8

Hi @audvin & @pommfrtt,

We have noticed this occurring on a very small subset of users after they log into their Twitter account. It is on the roadmap to be fixed, however we have no definite timeline. You are also safe to ignore as it doesn’t effect tracking or interfere with the end users browsing experience.


#9

remove type=“text/javascript” from script tags & it will be working fine :slight_smile: