View & Filters when Tracking Events for “virtual pages” in Google Analytics
I’ve discovered some unobvious “issues” when while trying to track events for “virtual pages” in Google Analytics. By “virtual pages” i mean when you push trackPageview with page URL specified instead of “default” value (that is current page URL).
Although you push trackPageview with URL specified, all events on that page will be tracked for current actual (or “real”) page URL. I.e. when you have your page with actual URL “myhost.com/page/” and trackPageview with specified URL like “myhost.com/mycustompageurl/” events will be tracked for original page URL (“myhost.com/page/”).
That may cause some unobvious behaviour when creating a View filtered by URL in Google Analytics . After creating such View you won’t see any of your events in reports, they will appear only in original view.
So if you need to somehow filter events for specific group of “custom” URLs there is two ways to do this:
1 —Use Universal Analytics (if you not migrated yet). Universal Analytics allows you to override actual page URL with ga(‘set’, ‘location’, ‘yoururl').
2 — Use alternatives for filtering: in my case problem was solved with creating additional Property with placing it (in addition to default tracker) on specific pages.