How to Setup Google Analytics in ↓markdown↓ CMS
To get a website that meets the visitors needs it is worth understanding who are the visitors. This can be achieved through collecting meta-data about the page requests made to the website. The Google Analytics service can provide reports on such web page meta-data. A website that uses the ↓markdown↓ CMS software can enable Google Analytics support.
Create a Google Analytics Account
To enable Google Analytics in ↓markdown↓ CMS you will require a Google Analytics account and you need to add your website to the account. This allows you to obtain a Tracking Id that is used to add the Google Analytics script.
Configuring Google Analytics in ↓markdown↓ CMS
A ↓markdown↓ CMS based website uses the Google Analytics script provided by Google. This requires the Tracking Id for it to operate. The Tracking Id is used to trigger the adding of the Google Analytics script to the website. The Tracking Id needs to be added to the website's ↓markdown↓ CMS configuration file. Using your website's control panel edit the site-config.php file and add the entry
TRACKING-ID in the
$MD_SETTINGS array, setting the value to the Google Analytics Tracking Id for your website. For example if the Tracking Id was AB-12345678-9:
. . . "TRACKING-ID" => "AB-12345678-9", "XML_SITEMAP_REFRESH" => "-1 week" );
Once the updated configuration file is saved on the web server the Google Analytics script is enabled. The script appears in all the web pages with the correct Tracking Id. (The script with the Tracking Id appears in all the web pages that use the ↓markdown↓ CMS system for publishing.)
To stop the Google Analytics script being added to the web pages remove the Tracking Id line from the site-config.php configuration file.
There are more tutorials covering ↓markdown↓ CMS in the article Build a Website from Scratch with ↓markdown↓ CMS.
Author:Daniel S. Fowler Published: