-
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Google Analytics javascript to Mocha docs.
Customising YARD templates is a bit obscure and this was the best I could come up with. The javascript appears as the last section within the content div, but before the footer div. Not ideal, but I think it should be ok. The tracking javascript is only displayed if the `GOOGLE_ANALYTICS_WEB_PROPERTY_ID` environment variable is set.
- Loading branch information
1 parent
b16ed30
commit e683d2a
Showing
4 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--template-path yard-templates | ||
--no-private | ||
lib/mocha/api.rb | ||
lib/mocha/hooks.rb | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script src="/javascripts/app.js" type="text/javascript" charset="utf-8"></script> | ||
|
||
<script type="text/javascript"> | ||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | ||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | ||
</script> | ||
<script type="text/javascript"> | ||
try { | ||
var pageTracker = _gat._getTracker("<%= ENV['GOOGLE_ANALYTICS_WEB_PROPERTY_ID'] %>"); | ||
pageTracker._trackPageview(); | ||
} catch(err) {}</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def init | ||
super | ||
if ENV['GOOGLE_ANALYTICS_WEB_PROPERTY_ID'] | ||
sections[:layout] << :google_analytics | ||
end | ||
end |