Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
1.5k views
in Plugins by
edited by

I created a plugin that will ease the insertion of Google Analytics in Q2A.

Features:
- inserts GA tracking code in the <head> part of the pages;
- Can exclude Super Administrator visits from tracking (if you don't want to count yourself as a visitor)
- You only need the UA-xxxxxxx-x ID (not as of v. 1.1 - see below)

Here it is: https://github.com/kufeiko/QA-Google-Analytics-Plugin/releases/latest

Any feedback appreciated!

UPDATE:

V. 1.1 is out!

What's new:

  • You must paste the whole tracking code, but that simplifies things and also:
  • should make the plugin compatible with other tracking services that could put js tracking code in the <head> section of the pages;
  • Now there's a ping URL that will notify you if the plugin gets a new version.

!!

2 Answers

+3 votes
by
Thanks Ivan for nice plugin.

I report small obstacle.

Even if it empties tracking code, script code remains.

google-analytics-layer.php (L10) ?
    // if (isset($google_UA)) {
    if (!empty($google_UA)) {
by
Gee, thanks for noticing! I've fixed it.
+3 votes
by
hi there,

I made a small patch for this plugin, that adds support for "setDomain" option of google analytics plugin... here updated source, pull request send also...

https://github.com/tanaydin/QA-Google-Analytics-Plugin
...