This is the rub to using the URL, this is only one page from the URL perspective, essentially the site is as a multi-page form. So the incoming URL does not change as the user progresses so the easy use of the URL won’t be possible.
If I put Google Analytics in the <head> block it then comes in from the main.php template. However for my google tracking I set specifically the page name as either Landing, Quote, or Confirmation depending on where they are at in the flow of the site.
The code for the <head> </head> block is contained in the main.php template an as mentioned it doesn’t seem to have access to a views passed in render() variables.
Previously I had the google script within each page with the proper view name being sent as the page and page label the user is on. In consolidating the scripts to a single place (in the head block) now I can’t do that and must set the page name based on something else.
The controller ID and action ID’s do not change. The way the multi-page form works is that only one Action handles the request and just changes the rendered view. So the action id would always be the same and I’m guessing since I only have one controller the same as well.
In my main.php (template) in the <head> block I have this code
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-abcdefghi-1', 'abcdefghi.com');
ga('require', 'displayfeatures');
ga('send', 'pageview' , {'page':'<?php echo $this->viewName; ?>', 'title':'<?php echo $this->viewName; ?>'});
</script>
What the optional parameters allow in ga send is to set the name of the page and the label that ga will use when I’m looking at a report. So in the report I will see the 3 pages as Landing, Quote, and Confirmation not just the root URL which does not change.
Hope this makes sense???
Sandy