Вы находитесь на странице: 1из 3

Internet Marketing Small Business Website

The previous Internet Marketing Small Business Website guide, looked at <head> code
optimizations to speed up page render time, making content appear faster.
Reducing the <head> JavaScript files loaded at initial run time, means recoding the <footer>
section to accommodate the new location for the scripts.
Such scripts may be needed only after the page has loaded, for example, enabling an image gallery
function.
Let us look again, using bolded examples below, at the specific files to be moved from <head>
section:
<!-- start code -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> [Name Of Page] </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.lightbox.js"></script>
<script type="text/javascript"> jQuery(document).ready(function() jQuery('.lightbox').lightbox(); );
</script>
<link rel="shortcut icon" href="favicon.ico" />
<meta name="description" content=" [Page Description] " />
</head>
<!-- end code -->
Footer Optimization: Page Load Time
Which JavaScript files can be safely moved to <footer> section?
Although there may be custom scripts located within the <head> section, which if moved could
affect the page functionality; there are many common JavaScript files that can be safely relocated.
Best practice to follow, would be to move JavaScript referenced dependencies one at a time, then
run page to determine efficiency of the code optimizations.
jQuery specific files, in bold within the upper code view, don't need to be run immediately & can be
moved into the <footer> section after the closure of all Division Tags [<div></div>], viz:
<!-- start code -->
</section>
</div>
<!-- end of all content blocks & divisions -->
<!-- Footer Code JavaScript Files -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.lightbox.js"></script>
<script type="text/javascript"> jQuery(document).ready(function() jQuery('.lightbox').lightbox(); );
</script>
<!-- End Of Footer Code JavaScript Files -->
</body>
</html>
<!-- end code -->
The jQuery LightBox dependent files moved into the <footer> section allow for all text & image
content to load much faster, & speed up the rendering time of the web page.
An additional JavaScript function, which is common to many Internet business websites, is the
Google Analytics Code Snippet. This function enables websites to capture important data about
individual pages.
The metrics generated, which could include: Social Media interaction; page load time; keywords
used, or number of visitors, are essential marketing tools for small businesses.
This particular script code can be moved into the <footer> section directly before the closing
<body> tag, thus:
<!-- start code -->
<!-- Google Analytics Code -->
<script>
(function(i,s,o,g,r,a,m)i['GoogleAnalyticsObject']=r;i[r]=i[r])(window,document,'script','//www.googl
e-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-XX', '');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
<!-- End Of Google Analytics Code -->
</body>
</html>
<!-- end code -->
Remove Render-Blocking JavaScripts
Analogous to speeding up page web page load time, is the optimization of JavaScript files which may
cause Render-Blocking.
This problem may appear when the script files within the <head> section are executed concurrently
[one after the other]. It's important to focus on optimizing such content delivery within ones overall
Internet marketing business plan.

Вам также может понравиться