1. How Precisely Can This “Trick” Speed Up Page Loading Time?
- on one hand it's them that turn “raw” HTML content into rich and interactive user experiences, (just think of all the cool animations that you get to “ornate” your content, of all the visuals that you get to captivate users with)
- yet, on the other hand, all this heavy loads of additional files mean a great pressure on your pages; the page rendering process gets significantly slowed down!
Needless to stress out that all this better structuring of the page rending process will have a dramatic impact on your Drupal site's performance.
Now before I delve deep into my explanations on how this module works and how precisely you get to leverage its functionality, the one that will help you move your files, let me try a short presentation first:
The AdvAgg Drupal module is a contributed one (for both Drupal 7 and for Drupal 8), “equipped” with its own aggregation system that replaces the out-of-the-box one that Drupal provides you with. It uses it (its system) for applying multiple site performance improvements and for adding on extra functionalities along the way.
First, you should know that it enables you to move either all of them or just some of the files! In addition to a couple of other “tempting” options that you get to scan through and choose from before you make this “relocation” on your Drupal site's pages.
What this module does precisely is what you want it do to: it moves your files in the footer as well as aggregate and compress them (it structures them into bundles, thus lowering the number of requests performed on a web page).
Moreover, it also grants you full control over these performance-boosting “maneuvers”.
“And how precisely do I use it for moving my files in the footer?” you might ask.
- navigate to "Modifications"
- select “Flush only the AdvAgg cache” in the Validation tab (again, just a suggestion to consider when in doubt, in case you're not sure which one of those options to go for)
And this is how you move them from the header of your pages to their footer!
Note: make sure that the AdvAGG module will work at its full potential by checking that the caching blocks are disabled and that the aggregation blocks are enabled.
Or, of course, you could be dealing with analytics or ads providing partners who insist on having their scrips running in the header.
Now when dealing with these particular exceptions, with “stubborn” providers insisting on having their scripts running in your pages' headers, the AdvAGG module “comes to your rescue” with another functionality that you can leverage. It practically extends its options for drupal_add_js and friends in order to incorporate a boolean scope_lock.
Another option available to you is to move these files slowing down the page rending processes on your site directly from your TPL file!
Here's how you do it:
1. you navigate to the page.tpl.php file of your theme
2. next you move the print $scripts to the footer of your page
Note: do keep in mind, though, that this second method does implies an in-depth understating of the code! So maybe it's not a tactic that you should recommend to those admins of the Drupal websites that you will be developing to try on their own each time they will want to make some tweaks for improving their sites' performance!