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

GMT ID not rendering on second site in multi-site setup #1523

Closed paulwaddington closed 1 month ago

paulwaddington commented 1 month ago

Question

Hi there! We've just converted an existing site to run a second site as a multi-site. The original site reders the GTM tracking code correctly, though even though the second site renders all of the meta data, it doesn't render the GTM ID

Additional context

The existing site was www.hn-company.co.uk and the second site is www.hnclinical.com Both sites are using Cloudflare, though I've been through and cleared SEOmatic template caches and also Cloudflare caches.

khalwat commented 1 month ago

SEOmatic stores its settings on a per-site basis. Make sure you set the settings as you want them for the new site:

Screenshot 2024-10-14 at 1 59 32 PM
paulwaddington commented 1 month ago

Hi Andrew,

Thank you for your reply… though the settings are site specific.

Paul Waddington

DDME 6 Harley Head Avenue, Halifax, HX3 8FD

M: 07870 651 374

https://www.ddme.uk https://www.ddme.uk/

On 14 Oct 2024, at 19:00, Andrew Welch @.***> wrote:

SEOmatic stores its settings on a per-site basis. Make sure you set the settings as you want them for the new site:

Screenshot.2024-10-14.at.1.59.32.PM.png (view on web) https://github.com/user-attachments/assets/26708de5-0afb-4838-99dd-b9cdeca75421 — Reply to this email directly, view it on GitHub https://github.com/nystudio107/craft-seomatic/issues/1523#issuecomment-2411914619, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDU2DPHDXMB3AVCP7MESHLZ3QBELAVCNFSM6AAAAABP5HW7EOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJRHEYTINRRHE. You are receiving this because you authored the thread.

khalwat commented 1 month ago

Can you show me screenshots from both site settings for GTM settings in SEOmatic for Tracking Scripts?

paulwaddington commented 1 month ago

Here you go Andrew…

Paul Waddington

DDME 6 Harley Head Avenue, Halifax, HX3 8FD

M: 07870 651 374

https://www.ddme.uk https://www.ddme.uk/

On 16 Oct 2024, at 02:22, Andrew Welch @.***> wrote:

Can you show me screenshots from both site settings for GTM settings in SEOmatic for Tracking Scripts?

— Reply to this email directly, view it on GitHub https://github.com/nystudio107/craft-seomatic/issues/1523#issuecomment-2415520967, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDU2DIVEJBEI2OPRKCARRDZ3W5VBAVCNFSM6AAAAABP5HW7EOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJVGUZDAOJWG4. You are receiving this because you authored the thread.

khalwat commented 1 month ago

@paulwaddington I'm not seeing any screenshots attached here?

paulwaddington commented 1 month ago

gtm-hn-patient gtm-hn-company

paulwaddington commented 2 weeks ago

Hi @khalwat, have you been able to review the acreen grabs?

khalwat commented 2 weeks ago

Okay so to test this, I have a two-site setup. Here are my settings for the first site:

Screenshot 2024-11-04 at 18 25 24

This is what SEOmatic outputs when I view the source of the first site:

<script>dataLayer = [];
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','MY-FIRST-SITE');
</script>

...and here are my settings for the second site:

Screenshot 2024-11-04 at 18 26 57

This is what SEOmatic outputs when I view the source of the second site:

<script>dataLayer = [];
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','MY-SECOND-SITE');
</script>

So it's definitely rendering a different ID for each site.

Is there anything else that could be going wrong here? Could the GTM code you're seeing on your site be coming from anywhere else?