asah / footprint2009dev

original dev repo for AllForGood.org
http://AllForGood.org/
0 stars 1 forks source link

loadGA() sometimes not defined in homepage [IE] #410

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On IE, if you return to homepage from a search page, it sometimes throws an 
error that loadGA() is not defined.  The reason is that the function is 
defined in the footer of base.html, but called in the content region of 
homepage.html.  That is, on homepage it's called before it's defined.

I just disabled it for now, in homepage.js line 47

Original issue reported on code.google.com by paul.rademacher on 18 Jun 2009 at 1:29

GoogleCodeExporter commented 9 years ago
I mistakenly thought I could safely disable this in homepage.js and that GA 
would still 
load in base.html.  It won't.

Marking as Critical to reenable loadGA for homepage before launch.  This can be 
as 
simple as adding HOMEPAGE as a case @line 161 of base.html

Original comment by paul.rademacher on 18 Jun 2009 at 1:39

GoogleCodeExporter commented 9 years ago
Adam pointed out that loadGA() definition can/should be moved to utils.js

Original comment by paul.rademacher on 18 Jun 2009 at 1:57

GoogleCodeExporter commented 9 years ago
I'll take care of all this tomorrow morning.  The reason loadGA() and callGA() 
are in
base.html and not utils.js already is because both use template variables.  
loadGA()
only uses the {{version}} variable, so if we're okay hard-coding in the version 
it
should be fine.

I don't think it's possible to move callGA() to external JS though, since it 
needs
the GA key variable, which is dependent on the instance and determined in 
deploy.py 
I could move the callGA() function to the <head> though.  I'll try it out 
tomorrow
and see what works.

Original comment by ehysen on 18 Jun 2009 at 2:02

GoogleCodeExporter commented 9 years ago
ah right, in that case, just define them earlier in base.html

Original comment by adam.sah on 18 Jun 2009 at 2:09

GoogleCodeExporter commented 9 years ago
Just committed r833 and r834 moving the functions to the header and re-enabling 
on
the homepage. We should be set now, working backwards:
* loadGA() is called on the homepage in the runSnippetsQuery() function in 
homepage.js
* homepage.js is loaded with the suprfetch call, but runSippetsQuery() isn't 
called
until the homepage.html template.
* The homepage.html template extends layout_full.html, which extends base.html
* loadGA() is defined in the head of base.html, which will be loaded by that 
point.
If I'm getting this chain right, we should be okay now.

Original comment by ehysen on 18 Jun 2009 at 3:04

GoogleCodeExporter commented 9 years ago

Original comment by ehysen on 18 Jun 2009 at 5:07