Tek Eye Logo

Tek Eye

How to Setup Google Analytics in ↓markdown↓ CMS

To get a website that meets the needs of the visitors' using it is worth understanding who they are. 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 and in more detail than just looking at a web server's log files. 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 (here abbreviated to md-CMS) you will require a Google Analytics account. You then add your website to that account. This allows you to obtain a Measurement Id, also known as the Tracking Id or Tag Id. Then md-CMS uses that Id as a setting to trigger adding the Google Analytics provided script called gtag.js to your website pages.

Configuring Google Analytics in ↓markdown↓ CMS

When building a website with md-CMS it can automatically use Google's gtag.js script. For it to operate, it requires your website's Google Analytics Id in the md-CMS configuration file. When md-CMS sees the Id in the configuration file it adds the gtag.js script to the web page being sent to the user's browser. If are in the process of installing md-CMS then setting up the configuration file is covered in Website Home Page for ↓markdown↓ CMS.

To add the Google Analytics Id to the website's md-CMS configuration file use your website's control panel and edit the site-config.php file. Add the entry TRACKING-ID in the $MD_SETTINGS array, setting the value to the Google Analytics Id for your website (see your Google Analytics account). 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 within all the web pages that use the md-CMS system for publishing, and with the correct Tracking Id.

To stop the Google Analytics script from being added to the web pages remove the Tracking Id line from the site-config.php configuration file.

See Also

Author:  Published:  Updated:  

ShareSubmit to TwitterSubmit to FacebookSubmit to LinkedInSubmit to redditPrint Page

Do you have a question or comment about this article?

(Alternatively, use the email address at the bottom of the web page.)

 This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

markdown CMS Small Logo Icon ↓markdown↓ CMS is fast and simple. Build websites quickly and publish easily. For beginner to expert.


Articles on:

Android Programming and Android Practice Projects, HTML, VPS, Computing, IT, Computer History, ↓markdown↓ CMS, C# Programming, Using Windows for Programming


Free Android Projects and Samples:

Android Examples, Android List Examples, Android UI Examples



Tek Eye Published Projects