Invision Community 5: A video walkthrough creating a custom theme and homepage By Matt Thursday at 04:02 PM
Durango Posted February 6, 2019 Posted February 6, 2019 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
Marc Posted February 6, 2019 Posted February 6, 2019 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.
Durango Posted February 7, 2019 Author Posted February 7, 2019 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
bfarber Posted February 7, 2019 Posted February 7, 2019 You can manually enter your javascript code into the globalTemplate HTML templates, instead of using the built in analytics setting.
Durango Posted February 7, 2019 Author Posted February 7, 2019 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 ?
bfarber Posted February 7, 2019 Posted February 7, 2019 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-->
Durango Posted February 7, 2019 Author Posted February 7, 2019 4 minutes ago, bfarber said: As long as you leave the setting set to "google analytics" what do you mean ?
Clover13 Posted February 8, 2019 Posted February 8, 2019 @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)?
bfarber Posted February 8, 2019 Posted February 8, 2019 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.
Durango Posted February 9, 2019 Author Posted February 9, 2019 Tx for this precious information @bfarber
lavicheats Posted March 5, 2019 Posted March 5, 2019 @bfarber sir so i did exactly like ytour screnshot abouve! do i still need copy the code manually in html code manually also?
bfarber Posted March 5, 2019 Posted March 5, 2019 Yes, you need to supply the Google Analytics/Tag Manager code, whether it be in the box supplied or by editing your theme manually.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.