Jump to content

Gtag Google analytics Tag placement


Durango

Recommended Posts

Posted

Hi

We noticed that the tool Google analytics tag in the ACP will place the tag at the end of the source code on the community

Whereas Google recommends its tag should be placed before </head> otherwise it might not work as expected in all cases (Google says)

Could IPS change this placement ?  tx ! 🙂

@Marc Stridgen @Charles

Posted

Have a check within your theme settings, you should see "Javascript include location" where you can switch this to either within the body or head.

Posted

Hi @Marc Stridgen

We have seen there are multiple javascript before /body, like more than 10

so we prefer not to include all of them in the head for a better web performance & UX

only the Analytics tag should be included before /head

How can we do that ? we know we can edit the global template file in the theme editor, is that the best solution ?

Also we read that IPS automatically send a view page to google analytics each time a dynamic content is charged on a page, (read on the google analytics page in the ACP) so will this still happen if we manually  include the Google analytics tag in the global template before /head ?

Tx for your help

Posted

Tx @bfarber

we read that IPS automatically send a view page to google analytics each time a dynamic content is charged on a page, (read on the google analytics page in the ACP) so will this still happen if we manually  include the Google analytics tag in the global template before /head ?

Posted

As long as you leave the setting set to "google analytics" (you may need to add something into the field for it to recognize it's in use, but you could use an HTML comment for that, something like

<!--Analytics code manually added elsewhere in global template already-->

 

Posted

@bfarber, you can set Analytics Provider to None and then manually add your GA code to the globalTemplate no?  Or is there some reason it has to be set to GA with commented code?  I have it set to None right now based on a previous conversation we had around capturing custom GA metrics/dimensions for guest vs member pageviews.  It works well for me, but I had to put it outside the IPS Analytics section and in the global template because I was doing a runtime PHP eval (to determine member vs guest) whereas the IPS Analytics code is static (stored in the DB) and doesn't get parsed/evaluated at runtime.

On 2/7/2019 at 9:29 AM, Durango said:

Tx @bfarber

we read that IPS automatically send a view page to google analytics each time a dynamic content is charged on a page, (read on the google analytics page in the ACP) so will this still happen if we manually  include the Google analytics tag in the global template before /head ?

How is this achieved?  The GTAG config call (whether in global template or the IPS GA setting) would send a pageview to GA automatically/implicitly (unless set to false).  What is a dynamic content change and how is a GA pageview called?  This is dependent on the Analytics setting being set to GA and having something (even a comment) in the property value (as in @bfarber's screenshot)?

Posted

If your analytics provider is configured as "Google Analytics" per my screenshot, then when a user paginates somewhere that uses AJAX pagination, we can explicitly register a pageview for Google Analytics by firing the appropriate javascript call. We only do this, naturally, if the provider is set as Google Analytics.

So, to address Durango's concern since he was aware of this behavior, I suggested just ensuring that "Google Analytics" is chosen on that page, which may require you to put in some sort of dummy value for the setting so it will save. As long as you have the GA javascript embedded somewhere on the page, this should work fine.

  • 4 weeks later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...