Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #13690

    Hi there

    Just following up on a previous thread, here:

    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

    Case-sensitive No

    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.

    Many thanks



    I’ve changed the tracking call to


    – so that a preview of “portfolio-item-stub” on /work isn’t confused with a view of the actual page /work/portfolio-item-stub.


Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘tracking ajax-revealed portfolio content into Google Analytics’ is closed to new replies.