Wiki source code of Custom HTML
Last modified by Normann P. Nielsen on 2012/12/30 13:12
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | Found In: Confluence Administration -> Look And Feel -> Custom HTML |
| 2 | |||
| 3 | At the Custom HTML level You can add global HTML that will be included through the entire site. | ||
| 4 | |||
| 5 | This can be links to static CSS files (on the server filesystem or added as an attachment on a page): | ||
| 6 | |||
| 7 | |||
| 8 | {{code}} | ||
| 9 | <link rel="stylesheet" type="text/css" href="http://www.mysite.dk/download/attachments/4161541/style.css"> | ||
| 10 | {{/code}} | ||
| 11 | |||
| 12 | This is the only place (GUI wise) that You can add to the <HEAD> tag. | ||
| 13 | |||
| 14 | Its a logical place to place things like extra JavaScripts and global styling, like Google Analytics: | ||
| 15 | |||
| 16 | |||
| 17 | {{code}} | ||
| 18 | <script type="text/javascript"> | ||
| 19 | |||
| 20 | if (!AJS.$('body').is('.login')) { // don't track logins | ||
| 21 | |||
| 22 | var _gaq = _gaq || []; | ||
| 23 | |||
| 24 | _gaq.push(['_setAccount', '*******']); | ||
| 25 | _gaq.push(['_trackPageview']); | ||
| 26 | |||
| 27 | if (AJS.params.spaceKey) { | ||
| 28 | // add the customVar to slot 1 with label 'confluence-space-key', value AJS.params.spaceKey & set the scope to page-level | ||
| 29 | _gaq.push(['_setCustomVar', 1, 'confluence-space-key', AJS.params.spaceKey, 3 ]); | ||
| 30 | } | ||
| 31 | |||
| 32 | (function() { | ||
| 33 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
| 34 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
| 35 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | ||
| 36 | })(); | ||
| 37 | } | ||
| 38 | |||
| 39 | </script> | ||
| 40 | <!--GOOGLE-ANALYTICS-PLUGIN-END--> | ||
| 41 | {{/code}} | ||
| 42 | |||
| 43 | {{include reference="Main.atlassian.atlassian-confluence.styling-confluence.custom-html.scopes.WebHome"/}} |