Schema.org in JSON LD format recognized by Google, but Facebook pixel helper does not detect it

Chirag Swadia picture Chirag Swadia · Jul 27, 2018 · Viewed 12k times · Source

I have added schema.org tags in JSON LD format using <script>, when I test my page using Google structured data testing tool, I can see all my tags.

But, when I installed Facebook pixel helper chrome extension to test my page, schema.org tags were shown as blank. Not sure why Facebook pixel helper is not able to detect it.

Would appreciate any help.

Answer

danlynn picture danlynn · Dec 11, 2018

I found that Facebook Pixel is more strict in its parsing of structured data. Blank line feeds in fields will cause it to throw up warnings. This occurred to me when I had line feeds in an address. The address was correctly interpreted by google, but Facebook Pixel put up warnings in the console.

Adding the following code resolved it in my case:

$address = preg_replace( "/\r|\n/", " ", $address );

Of course, as pointed out here JSON doesn't support real line-breaks.