Fortunately, its very easy to upgrade any Day CQ5.x sites that use the previous incarnation of the Google tracking code from base page component.
There are 3 steps to updating the existing Google analytics implementation to an asynchronous one
- Overlay the analytics.google.jsp in /apps/foundation/components/page/ with an async version
- Create a script block to queue Google Analytics commands (trackPageView)
- Add that script block to the section of the base template by overriding head.jsp in the overlayed component
This will override the one built into CQ. If you find that it is not working out for you, then remove these files and you will go back to the original tracking code (make sure you flush any caches here too).
You could always add as an alternative provider for analytics by setting it up as
/libs/foundation/components/page/dialog/items/items/analytics/items/provider/options/google-async
and renaming the files accordingly. It probably wouldn't hurt to use the provider selection logic in the queue jsp also. However, it is great to see how easy it is to override out of the box CQ functionality.
0 comments:
Post a Comment