Jay Mckinlay
Jay Mckinlay

Reputation: 21

JSON-LD Schema Clashing with Facebook Pixel

I have recently been creating my own JSON-LD schema for my Wordpress site.

I have run the schema through Googles Structured data testing tool and all is well.

However, once I insert it to the page I am getting an error "fbevents.js:23 [Facebook Pixel] - Unable to parse JSON-LD tag. Malformed JSON found: '{" - then the entire schema is shown in the console. This is happening on every page I have Facebook Pixel running on.

I have never had the issue before with schema plugins etc so I am assuming its something I am doing - does anyone have any ideas?

URL: https://www.thetravellinghousesitters.com/how-to-become-a-house-sitter/

If anyone needs anymore information let me know.

Thanks

Upvotes: 2

Views: 1770

Answers (3)

Joe Henriod
Joe Henriod

Reputation: 11

I had this issue because I included comments in my Schema. The Google Validator would say it's all right, but the Facebook Pixel would clash with ANY commenting.

Upvotes: 0

David G.
David G.

Reputation: 35

I had the same issue. For some reason, I had a semicolon at the end of my JSON Code.

Removed and it all works fine now.

                    "bestRating": 5,
                    "ratingValue": 5
                }
            }
    }]
};   // This semicolon in the last line was the culprit
</script>

Upvotes: 0

Tony McCreath
Tony McCreath

Reputation: 3409

Right at the end of your How-to you have an extra comma:

"totalTime": "P2D" },

I suspect the SDTT can deal with that syntax error, but Facebook can't.

Upvotes: 2

Related Questions