Track Page Views
Put the <push-broom> element on the pages you want counted.
<push-broom url="/page-slug"></push-broom> Two things about that tag are load-bearing.
The hyphen. A custom element name has to contain one. Spell the tag pushbroom instead and the browser treats it as an unknown element, the script never finds it, and nothing is recorded. There is no error anywhere. This is the most common reason an install looks correct and reports nothing.
The closing tag. <push-broom url="/x" /> does not close itself in HTML. Write </push-broom>.
Choosing the url
url is the path the view is filed under, and you pick it rather than the browser. That matters when the real path carries something you would rather not keep: a page served at /orders/8812/receipt can report itself as /orders/receipt, and the order number never leaves the browser. It is also how you aggregate — a thousand paths that are really one page can report themselves as one page.
Client-side routing
The element watches its own attributes. If your router rewrites url in place, that is a new page view; you do not have to remove and re-add the element. Anything else that happens on the page is not a page view, so a re-render will not double-count.
One element per page is enough.
Adding context
Attributes starting with pb: are recorded alongside the view, and become something you can filter and group by. See custom data for those, and custom events for recording things that happen after the page has loaded.
Last updated