angulartics / angulartics-piwik

Piwik plugin for Angulartics
MIT License
27 stars 14 forks source link

Delay tracking until page is rendered #12

Closed AndrewIsh closed 7 years ago

AndrewIsh commented 7 years ago

I have a site that displays information supplied by API calls. I would like to track one of the properties of that information. So, the controller of the view that displays the information, once the API promise has resolved, calls:

$window._paq.push(['setCustomDimension', id, value]);

id & value being the dimension ID and value of the property I wish to track (I have set up a custom dimension), value is the property that has been supplied by the API call.

My problem is that the tracking call to piwik.php is being made before my API promise has resolved and the custom dimension has been set.

Does anyone have any suggestions for how to trigger the tracking call manually, after the API promise has resolved and I've set my custom dimension in the _paq object?

Many thanks!

AndrewIsh commented 7 years ago

OK, this isn't a angulartics-piwik issue at all. There's a discussion already in progress at angulartics: https://github.com/angulartics/angulartics/issues/112

Apologies for the noise.