Re: [Tiki-devel] Where to put the new GA4 codes?

Rick Sapir <[email protected]>
Newsgroups gmane.comp.cms.tiki.devel
Message-ID <[email protected]>
Did you wrap it in a {literal} tag?

I just put this:

{literal}

<!-- Google Tag Manager -->
<script>(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','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->

{/literal}

on the demo site (https://demo.tiki.org/25x/) and it seems to work fine.

HTH,

-R

Rick Sapir
ricksapir.com
@ricksapir

Creating Content -- Managing Information

On 12/21/2022 5:00 AM, Jay Williston wrote:
> Hi.. I've tried EVERYTHING..  but can't seem to find a way to put this 
> code in the header area (not the body).  Everything I try breaks the site.
>
> Notice this is not the UA code google used to use.. it's the new GA4 
> code that Google Analytics is using now.
>
> So, I can't use the Google Analytics plugin because it puts a UA in 
> front of it.. and.. uses a different script.  It also puts the code in 
> the body and not in the head!  (client insists it has to go in the 
> head tag)
>
> I've tried to include this in the header.tpl   It breaks the site
> - I can throw in a "<script></script>"  but any more than that and it 
> breaks the site
>
> I've tried to use this Look/Feel >> Customization >> Custom HTML head 
> content... .and it breaks the site
> - I've tried it with and without comment tags..
>
> Thoughts?
>
> <!-- Google Tag Manager -->
> <script>(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','GTM-TJ62RTB');</script>
> <!-- End Google Tag Manager -->
>
>
>
> -- 
> Jay Williston
> He/Him (What's this? 
> <https://www.thehrcfoundation.org/professional-resources/talking-about-pronouns-in-the-workplace>)
> IRN Internet Services
> PO Box 1428
> Fitchburg, MA  01420
> 617-417-5749
>
>
> _______________________________________________
> TikiWiki-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel

_______________________________________________
TikiWiki-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.