Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript execution tracking in Chrome - how?

I have ~ 100-200 javascript functions loaded on a web-site. I want to determine what javascript function is executed when i click one item or another in Google Chrome. How can i do it with Chrome Web Developer Tools? Thanks!

like image 479
Pave Avatar asked Feb 03 '12 09:02

Pave


People also ask

How do you track JavaScript?

click on "Tracking Code" in the left menu (under the "Measurables" or "Websites" menu) click on "JavaScript Tracking" section. select the website you want to track. copy and paste the JavaScript tracking code into your pages, just after the opening <body> tag (or within the <head> section)

How do I view JavaScript variables in Chrome?

To view any variable in chrome, go to "Sources", and then "Watch" and add it. If you add the "window" variable here then you can expand it and explore.

How do I Unminify JavaScript in Chrome?

Drill down to the file you and double-click to open it in the preview pane: If you look in the lower left corner, you'll see 2 curly brackets. By clicking on this, the minified file expands open to an unminified state.


1 Answers

One simple approach is to start Chrome Developer Tools, switch to the Sources panel and hit F8 (Pause Execution). This will break on the first executed JavaScript statement.

Another approach is to set an event listener breakpoint for mousedown or click: in the same Sources panel, expand the "Event Listener Breakpoints" in the righthand sidebar. Expand the "Mouse" item and check the events you want to break on (e.g. "click", "mousedown"). Then go click in your page and see the JS execution break in the DevTools. Enjoy!

like image 95
Alexander Pavlov Avatar answered Sep 20 '22 01:09

Alexander Pavlov