nystudio107 / craft-seomatic

SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
https://nystudio107.com/plugins/seomatic
Other
166 stars 71 forks source link

SeoMatic adding JavaScript Run Queue code AFTER the closing </body> tag #1496

Closed johneemac closed 4 months ago

johneemac commented 4 months ago

On the latest version of Craft 5 and latest Seomatic.

This seems to be down to SEOMatic as when i disable it in the plugin settings the injected script does not appear after the closing body tag.

It's not a massive issue, but it's invalidating my HTML.

` < /body> < /html>

< script type="text/javascript"> < <![CDATA[/ ( function(){ t ry { v ar req = new XMLHttpRequest(); req.open('GET', "https:\/\/localhoster\/actions\/queue\/run", true); req.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); if (req.readyState === 4) return; req.send(); } catch (e) {} })(); /]]>*/ `

Any ideas? Thanks.

khalwat commented 4 months ago

If I had to guess, perhaps you're using SEOmatic to inject some tracking scripts into your page, and perhaps they've been modified in some way? By default, SEOmatic would not be doing what you're describing.

I tested SEOmatic with Craft 5 on my test setup, and it is not adding a JavaScript like the above to the page.

Closing this up, but happy to continue helping you figure out where it's being added. Check SEOmatic -> Tracking Scripts and see which ones are enabled, and then check if they've been modified in some manner.

johneemac commented 4 months ago

Hi Andrew, thanks for the quick reply.

Whilst in further testing it looked like Seomatic, it also happened on a few occassions with it disabled. Seems like something else...

I've been in touch with the PT guys and will post back here if anything related to SeoMatic.

Thanks again for quick response.