Just following up on a previous thread, here: http://www.kriesi.at/support/topic/google-analytics-event-tracking#post-49325
Angular is fantastic, but tracking content properly into web analytics is a challenge.
In js/avia.js, after line 564 (i.e. at the bottom of the success function) I've added this
// GA function
The result is that portfolio views are tracked into GA as a pageview, e.g. like this
where 1234 is the ID of the portfolio item in WordPress, and /work is the page that the user is on when they view the portfolio preview.
I've then added a filter to GA for each portfolio item:
Custom > Advanced
Field A -> Extract A (.*)\/1234(.*)
Field B -> Extract B [leave blank]
Output To -> Constructor $A1/portfolio-item-stub$A2
Field A Required Yes
Field B Required No
Override Output Field Yes
This rewrites /work/1234 as /work/portfolio-item-stub in the GA content reports.
The tracking behaviour that my placement of the tracking call in avia.js produces is this:
- when you first load a portfolio item, a tracking call is fired [great]
- if you close the preview , nothing happens [if you think about the user journey and the way the user sees things, I think this is fine]
- if you load a different item, that second item causes a pageview to be tracked [great]
- if you go back to an item that you previously loaded, a second pageview is NOT tracked [mmm I'd prefer it if another call was fired]
- if you use the arrow buttons to move to the next portfolio preview, it tracks [great]
I hope this is helpful for others. It would be good to get some advice on how I can make my pageview call fire when the same item is viewed a second time; and if there's a way of tracking the item stub directly to GA, instead of having to maintain all those GA filters.