TAILIEUCHUNG - Developing Large Web Applications- P27

Developing Large Web Applications- P27:This book presents a number of techniques for applying established practices of good software engineering to web development—that is, development primarily using the disparate technologies of HTML, CSS, JavaScript, and server-side scripting languages. Whereas there are many books on how to use languages, how to use libraries, and how to approach software engineering, this is the first book to codify many of the techniques it presents. These techniques will make the components of your own web applications more reusable, maintainable, and reliable | An additional approach for managing sprite files is to create one per CSS file. This way whenever the sprite changes you know that only its associated CSS file needs to be updated to reflect the new sprite file and changes to offsets. Again a naming convention can help document this approach. For example for the CSS file containing the CSS for one section of the application you can create a sprite file called that contains all the JPEG images for just that section. Control Over Site Metrics Although not directly related to performance from the standpoint of how fast a page loads the ability to capture metrics about how visitors are using your web application does tell you a great deal about other aspects of how your application is performing with regard to the overall user experience. In this section we ll look at an easy approach for adding Google Analytics to a large web application. Google Analytics is a free service that provides great tools for analyzing how visitors are using your web application. Once you register for the service enabling metrics for your site is simply a matter of adding a snippet of code to the right place on all pages that you want to track. As we have discussed several times throughout this chapter the SitePage class that you define for use by all pages across your application offers a logical place to manage this code. Example 9-10 illustrates this. Example 9-10. Adding Google Analytics across an entire web application class SitePage extends Page protected google_site_id protected google_site_nm public function construct You get the ID for your site once you ve signed up with Google. this- google_site_id . this- google_site_nm . public function get_all_js First get all the JavaScript that was assembled for the page. js parent get_all_js This is the snippet of Google Analytics code from registering. analytics EOD -- Google Analytics -- script type text javascript Control Over Site Metrics 241

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.