简体   繁体   English

JSON-LD 模式与 Facebook 像素冲突

[英]JSON-LD Schema Clashing with Facebook Pixel

I have recently been creating my own JSON-LD schema for my Wordpress site.我最近一直在为我的 Wordpress 网站创建自己的 JSON-LD 模式。

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.但是,一旦我将其插入页面,我就会收到错误“fbevents.js:23 [Facebook Pixel] - 无法解析 JSON-LD 标记。发现格式错误的 JSON:'{” - 然后整个架构显示在控制台中. This is happening on every page I have Facebook Pixel running on.这发生在我运行 Facebook Pixel 的每个页面上。

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/网址: https ://www.thetravellinghousesitters.com/how-to-become-a-house-sitter/

If anyone needs anymore information let me know.如果有人需要更多信息,请告诉我。

Thanks谢谢

Right at the end of your How-to you have an extra comma:在您的操作方法的末尾,您有一个额外的逗号:

"totalTime": "P2D" }, “总时间”:“P2D”},

I suspect the SDTT can deal with that syntax error, but Facebook can't.我怀疑 SDTT 可以处理该语法错误,但 Facebook 不能。

I had the same issue.我遇到过同样的问题。 For some reason, I had a semicolon at the end of my JSON Code.出于某种原因,我的 JSON 代码末尾有一个分号。

Removed and it all works fine now.已删除,现在一切正常。

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

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. Google Validator 会说没关系,但 Facebook Pixel 会与任何评论发生冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM