For my Grails application I want to set up Google Analytics to track only “partial” url’s. I ‘ll explain:
- a typical Grails url consists of the following parts: domain + application-name + controller + action + id
- e.g. http://www.mydomain.com/myapp/controller/action/12345
As far as I understand for Google Analytics the page to be tracked is identified by the entire url. For my purpose I’m not interested in the id part of the url: I want to know which actions have been performed, but I need not know for which id the action was executed.
And of course I would like a generic solution, because I have multiple controllers and multiple actions… Maybe some kind of filter stating “I want to track pages 3 levels deep (/myapp/controller/action)” would do? Or a filter stating “exclude everything from url after the last /”?
Any help would be much appreciated.
Kind regards,
Pieter
I think this question is best answered by this article.
As the other contributors suggested, I too thought the issue should be resolved in Google Analytics. I clicked around a bit and got hopelessly confused.
Solving the issue within Grails is much much easier. In short the answer is:
“_trackpageview” action
application/controller/action
variables in the Grails views)
Hope this will help others.
Thnx for the other answers.