2

We are building an AngularJS app and we want to integrate CrazyEgg tracking. Normally on a server rendered web app, like any other tracking tool, you just add the tracking code just before the closing.

How would it work on an AngularJS app? I am pretty sure that adding the tracking script on the index.html won't work, as it won't pick up the state changes, plus, it might not be loaded in time on app startup.

Any ideas? How could that work?

LarsTech
  • 80,625
  • 14
  • 153
  • 225
Iraklis Alexopoulos
  • 909
  • 2
  • 14
  • 27

2 Answers2

1

One option is to do essentially the same thing as this answer for Google Analytics with Angular: Tracking Google Analytics Page Views with Angular.js

The difference is that CrazyEgg does not seem to support the simple push functionality, so when the view loads you may need to remove the CrazyEgg <script> tag and then insert it again. As long as the url is different for the new view this should work. (Note that I haven't tested it, however.)

Community
  • 1
  • 1
glortho
  • 13,120
  • 8
  • 49
  • 45
  • Interesting, thanks glortho, I was actually thinking of doing something along these lines, either listening for the $viewContentLoaded or the $stateChangeSuccess event. – Iraklis Alexopoulos Jul 01 '14 at 05:36
1

I use Crazy Egg with a Tealium implementation on the Angular site. It's been working for some pages through Crazy Egg itself, but we had some issues with content loading properly. I was able to use the chrome extension they have available (Page Camera) to take a screenshot of the page. After a few days, the data started to show.

jkmarathoner
  • 71
  • 1
  • 6