How do I add Google Analytics into my templates?
This page describes how to add Google Analytics-JavaScript into templates in SEOCMS.
The reason for adding the JavaScript into templates is because every page will use some of these templates. Therefore, the JavaScript will be embedded on every page in your SEOCMS.
The JavaScript form Google Analytics starts with this code <script type="text/javascript"> and ends with this </script>
To add the script into SEOCMS you must delete the first and last row of code.
This example shows the Google Analytics-JavaScript with the first and last row of code included.
Warning! Remember to copy your own code from Google Analytics. This example will not work for your SEOCMS-site.
<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">
var pageTracker = _gat._getTracker("XX-XXXXXXX-X"); pageTracker._trackPageview();
</script>
|
This example shows the Google Analytics-JavaScript without the first and last row of code.
Warning! Remember to copy your own code from Google Analytics. This example will not work for your SEOCMS-site.
|
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">
var pageTracker = _gat._getTracker("XX-XXXXXXX-X"); pageTracker._trackPageview();
|
Add Google Analytics into template in SEOCMS:
- Select Site layout. (Three tabs to right right of Pages)
- Choose a template (Google Analytics-JavaScript will be added to every template)
- Select Components. (Next to pages).
- Drag and drop the JavaScript-module into a container.
The properties for the JavaScript-module is shown.
- Enter name for the JavaScript-module. (i.e. Google Analytics)
- Enter the text (code) (The JavaScript from Google without the first and the last row of code) into the textfield.
- Click Update.
- Save template.
Repeat the stages above for every template so that Google Analytics is embedded on every page and template in SEOCMS.
Tip!
Copy the JavaScript-module after you have finished the first template. In this way you can right-click and paste in the module into the next template.
This chapter explains how to copy modules within pages and templates in SEOCMS.
More information about the JavaScript-module is found here: