by Anton
28. June 2013 01:19
In the past weeks I have worked quite a bit with JavaScript. I encountered that not all eventtracking scripts for Google Analytics have been executed. I guessed it could have something todo with registering startup scripts within an update panel. And I delved into this topic, looking for solutions on the internet.
WRONG!
As a developer I should know better. Guessing is rarely a good strategy. I should have applied the following logic: An event does not appear in Google Anlytics. Therefore a eventtracking script is not being fired. So either the code is never reached or it is faulty. The right thing to do would have been to start the website locally, navigate to the appropriate point, and look whether the script is being executed.
Here is where Firebug comes into play. It shows me whether the script is being loaded. It tells me whether the browser encountered errors while executing the script. I can put breakpoints into the script and see whether the code is being executed.
Would I have done this right away, I would have seen, that I formatted a parameter for the tracking function incorrectly. I would have saved a lot of time.
Fiddler is another essential tool when developing web applications. You can see the data that is being send with the request, see the resonses and the errors even if they are not shown in a postback, and much more.
In essence I should use Fiddler and Firebug more to get to the root cause of errors. Then I can invest my time at the right places to remedy the bugs.