john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

drupal 09 google analytics statistics read counter

DRUPAL7

STATISTICS (and page reads counter) is easily enabled in Configuration

set names utf8; select node.nid,node_counter.nid,node.title,node_counter.totalcount from johnpfe5_physics.node left join johnpfe5_physics.node_counter on node.nid = node_counter.nid;

Note: Doesn't seem to increment node_counter if the story was imported using node_export


Prerequisite: a http://google.com/analytics user and the "unique id" (UA-xxxxxxx-x)

Download "google analytics" module from Drupal.org (download -> modules -> search analytics)

http://drupal.org/project/google_analytics (was http://drupal.org/node/37694)

tar -xzvf google_analytics-6.x-2.2.tar.gz (-xz means un gzip and extract from tar) (or double click it from a GUI that has archive opening software)

Extract it to a folder...

FTP into my webhosting cd to the root directory of the Drupal folder cd /drupal-root/sites/all upload the google_analytics folder (end result will be /drupal-root/sites/all/google_analytics)

Enable the google analytics module by clicking the checkbox and the Save Configuration button Administer -> Site Building -> Modules (or http://website/admin/build/modules/list)

Configure the google analytics module (add the UA-xxxxxxx ID from google) Administer -> Site Configuration -> Google Analytics
(or http://website/admin/settings/googleanalytics)

Also, you may want to limit the roles tracked to Anonymous or only some registered users... you probably don't want to count how many times you (or your admin) logged on to do work...

So choose to add tracking for the roles you desire BUT definitely choose to Add Segmentation


Download then upload the extracted... http://drupal.org/project/xmlsitemap

Enable via Administer -> Site Building -> Modules (or http://website/admin/build/modules/list)

Update your robot.txt file: Sitemap: http://www.example.com/sitemap.xml

Run "update.php" and "run cron" (manually even!) to ensure that your Drupal content is updated.


drupal-6-hit-counter-statistics

enable the core module for statistics (with the checkbox SAVE) admin/build/modules

then enable access log settings admin/reports/settings

Anonymous user permission to see log/access info...

/admin/user/permissions statistics module access statistics view post access counter

Now you'll see how much each post is read (but not on the main page?)

http://drupal.org/project/statistics_advanced

You can improve the way statistics works with the above module. (which also requires browscap http://drupal.org/project/browscap)

admin/reports/settings/advanced Now you can ensure you're not counting the ADMIN user's hits.


google analytics custom php block to drupal

/admin/structure/block

Add Block (description = GoogleAnalytics)

Paste into the Block Body

Dropdown = format = php

Save

Verify (i.e. use private browsing mode and hit a few pages and view the source to ensure the javascript above is there)


  • « drupal7 multi lingual installation
  • jsp login ip forwarded »

Published

Aug 19, 2012

Category

drupal

~388 words

Tags

  • 09 1
  • analytics 1
  • counter 2
  • drupal 43
  • google 18
  • read 14
  • statistics 1