Jump to content

Gtag Google analytics Tag placement


Durango

Recommended Posts

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

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

@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)?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 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...