Page Speed Insights, Asynced .JS and CloudFlare's Rocket Loader

1,453 views
Skip to first unread message

AJ at WpFASTER.org

unread,
Aug 14, 2014, 3:59:53 PM8/14/14
to pagespeed-ins...@googlegroups.com
Hello all,

I am getting the mother of all run-arounds from CloudFlare on this so I thought I might ask here.

Any one have any idea why Page Speed Insights does not recognize a Rocket Loader enabled script as being loaded asynchronously?

Example test from our site: https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.wpfaster.org%2F&tab=desktop

CloudFlare's Rocket Loader feature, when enabled, does in fact async scripts, and other online tools such as Pingdom, GTMetrix, WebPageTest.org etc do recognize this. But not Page Speed Insights... it shows all Rocket Loader enabled scripts as render blocking.

The concern, of course, is that if Page Speed Insights is not recognizing Rocket Loader enabled scripts as being loaded asynchronously, then the algorithmic means Google employs to rank sites in SERPs based on ranking factors such as speed may not be either. (Ergo, it would behoove one to employ a different asyncing method or means by which to defer the parsing of JavaScript if, in fact, Google does not recognize CloudFlare's method and does not recognize it universally).

Many thanks,
AJ

Dave Mankoff

unread,
Aug 14, 2014, 4:14:19 PM8/14/14
to pagespeed-ins...@googlegroups.com
Howdy AJ.

A quick look at your html source shows this:


That is not being loaded async. It would need the "async" attribute to qualify, in this case.

It should be noted that it looks like a lot of your inline JS relies on JQuery which is defined in this file. Odds are that if you simply add the "async" attribute, the code will break. A little engineering effort should get your around this hurdle.


-dave mankoff

AJ at WpFASTER.org

unread,
Aug 14, 2014, 7:47:58 PM8/14/14
to pagespeed-ins...@googlegroups.com
Hi Dave, and thanks for the response,

Correct: nothing is currently being asynced. And yes, merely adding the <async> attribute to the script tag does break the site (sort of: Responsive Text notwithstanding, everything else is fine).

The specific question, however, is why Page Speed Insights does not recognize a CloudFlare, Rocket Loader enabled script as a script being loaded asynchronously, when indeed it is.

The feature is disabled on our site at the moment (and I'm guessing was when you checked the source); but, were it enabled, the script you cite would look like so: <script type="text/rocketscript" data-rocketsrc="http://www.wpfaster.org/wp-content/cache/minify/000000/08a8a/default.include-body.9a8df7.js"></script>

^ This script is, in fact, being loaded
asynchronously with Rocket Loader enabled, and is recognized as such by all other online tools: such as Pingdom, GTMetrix, WebPageTest.org, WebsiteTest.com, etc. ...

...But not Page Speed Insights. I am wondering why this is.

AJ

Dave Mankoff

unread,
Aug 15, 2014, 10:24:06 AM8/15/14
to pagespeed-ins...@googlegroups.com
Interesting. I'm not sure without looking at it. Can you provide an example page or reenable it? I'd be curious to take a look.


-dave mankoff

AJ at WpFASTER.org

unread,
Aug 15, 2014, 10:35:08 AM8/15/14
to pagespeed-ins...@googlegroups.com
Re-enabled, Dave.

AJ

Dave Mankoff

unread,
Aug 15, 2014, 11:32:59 AM8/15/14
to pagespeed-ins...@googlegroups.com
Interesting. When I view that in my browser, I see the "rocket" loaded script. When I load the page through our PSI infrastructure, however, all references to "rocketsrc" are gone, and the script is loaded in a blocking fashion.

It sounds like CloudFlare is doing some trickery with either the User Agent or Google's IP addresses. I suspect the latter, as changing my user agent in my browser doesn't seem to affect anything.


-dave mankoff

AJ at WpFASTER.org

unread,
Aug 15, 2014, 11:56:14 AM8/15/14
to pagespeed-ins...@googlegroups.com
Thanks again. Questions:

1.) Care to conjecture a motive for why CloudFlare would do such a thing for Google and Google only?

2.) Would you call it a safe deduction, then, that Google's crawlers and ranking algorithm(s) are also not 'seeing' the asynced, Rocket Loader enabled .js?

Also:
3.) Does Page Speed Insights test through an actual browser or is it simply programmed to recognize standard HTML5 script attributes and then assume asyncing/deferring is occurring for the scripts to which those attributes are applied?

Best,
AJ

Dave Mankoff

unread,
Aug 15, 2014, 1:35:48 PM8/15/14
to pagespeed-ins...@googlegroups.com
Replies inline.

-dave mankoff


On Fri, Aug 15, 2014 at 11:56 AM, AJ at WpFASTER.org <wpfa...@gmail.com> wrote:
Thanks again. Questions:

1.) Care to conjecture a motive for why CloudFlare would do such a thing for Google and Google only?

No idea. Maybe they know something that I don't? In general, I would discourage that type of thing.
 

2.) Would you call it a safe deduction, then, that Google's crawlers and ranking algorithm(s) are also not 'seeing' the asynced, Rocket Loader enabled .js?

Webmaster Tools has a "Fetch as Google" feature that allows you to submit a request as the Google bot to a single page. You can see the HTML that Google gets by using this tool.

It only works for sites that you have registered, so you'll need to use your own account to test this.
 

Also:
3.) Does Page Speed Insights test through an actual browser or is it simply programmed to recognize standard HTML5 script attributes and then assume asyncing/deferring is occurring for the scripts to which those attributes are applied?

The resources that it lists as blocking are blocking actual paints. We do in fact render each page that comes in, (you'll notice the screenshot that we provide with each analysis).

Different browsers on different operating systems and devices may have different results in practice. For instance, versions of Opera prior to their change in rendering engine have a flash of unstyled content (FOUC).

AJ at WpFASTER.org

unread,
Aug 15, 2014, 2:25:36 PM8/15/14
to pagespeed-ins...@googlegroups.com
You have been a giant help, Dave. Thanks once more.

I hadn't thought of using the "Fetch as Google" feature in WMT, so thanks for that in particular.

After fetching a few different pages on our site with Rocket Loader enabled, Google bot in fact does not recognize CloudFlare's async attribute, as all references to Rocket Loader ("rocketsrc") are stripped and replaced with standard script tags (this is exactly what IE does too).

Do you think it safe to assume then that Googlebot 'sees' Rocket Loader enabled scripts as scripts that are being loaded in a blocking fashion?

AJ

Dave Mankoff

unread,
Aug 15, 2014, 2:45:34 PM8/15/14
to pagespeed-ins...@googlegroups.com
If the fetch-as-google feature is seeing standard, non-async script tags (which is what PSI is getting) then yes, those scripts are seen as blocking.

I want to be be clear and add a disclaimer that I am not on the record as stating that blocking scripts affect your ranking either positively or negatively, nor am I commenting on what degree it might affect them. PageSpeed Insights is first and foremost a tool for helping you make your website faster for your visitors.



-dave mankoff

AJ at WpFASTER.org

unread,
Aug 15, 2014, 3:07:12 PM8/15/14
to pagespeed-ins...@googlegroups.com
I appreciate all the help, Dave.

I also understand (and was expecting) the disclaimer.

That said, given that Page Speed Insights in fact deducts points for render blocking scripts since they generally delay rendering of a page, and since Google has had site speed as a ranking factor since 2010, it follows -- necessarily -- that it behooves one to make use of asyncing or deferring methods that Google recognizes, if one is in fact wishing to async or defer their JavaScript in hopes of improved ranking in Search Engine Results Pages (SERPs).

Best,
AJ

Stefano R

unread,
Feb 25, 2016, 3:27:45 AM2/25/16
to pagespeed-insights-discuss
Would like to ask - 18 months later has this changed in any way? Still notice pagespeed insights doesn't appear to recognize that cloudflare is loading js with async which seems incorrect as the end user is clearly benefiting from this feature that cloudflare provide. Does google recognize the performance increase and non-blocking feature that cloudflare provides?

WpFASTER.org

unread,
Feb 25, 2016, 7:24:29 AM2/25/16
to pagespeed-ins...@googlegroups.com
Hello Stefano,

PageSpeed Insights generally still sees Rocket Loader enabled JavaScript as blocking actual paints, yes. It does not in most instances, however, as can be verified by running any webpage with Rocket Loader enabled through Google's real-world testing platform WebPageTest.org.

It is important to remember that GPSI is really a very basic (and not without its bugs) best practices tool designed for ease of use by the layperson. What Google recognizes and rewards is how performant a webpage/website is overall relative to other sites competing in the same space, so whether or not Google rewards the use of Rocket Loader isn't really the question. This post on our blog by AJ might help being things into focus: https://www.wpfaster.org/blog/website-load-time-does-not-matter 

Looking forward,
Sam D.
Senior Client Support Representative & Project Management Lead
Our Hours of Operation Are: Mon - Fri, 7 a.m. to 5 p.m. EST
SPEED. GET SOME.

--
You received this message because you are subscribed to a topic in the Google Groups "pagespeed-insights-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pagespeed-insights-discuss/5aZNw-3ypBo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pagespeed-insights-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pagespeed-insights-discuss/eb8f1c85-c761-4b1a-9a3c-28289d4f0774%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

PureLocal Australia Business Directory

unread,
Dec 4, 2016, 1:03:42 AM12/4/16
to pagespeed-insights-discuss
https://www.purelocal.com.au

Cloudflare appears to be completely useless :

Firstly we have JS defer "ON" but all page tools don't reflect this.

Secondly redirects don't work :
https://www.purelocal.com.au/sydney?page=1
>> 301
https://www.purelocal.com.au/sydney

What is the point of Cloudflare exactly? At this point it only appears to be adding 2 seconds of connection time (TTFB) and doing nothing else...

PureLocal Australia Business Directory

unread,
Dec 4, 2016, 1:10:02 AM12/4/16
to pagespeed-insights-discuss
Cloudflare does not compress CSS , Javascript or anything else according to all tests.






On Friday, August 15, 2014 at 7:59:53 AM UTC+12, AJ at WpFASTER.org wrote:
Reply all
Reply to author
Forward
0 new messages