Helping Others Help Others

Our expertise at your disposal. Ready for more? View all blog articles or contact us.

Disable Google Analytics by Role, User, or nid

If you utilize the code to disable Google Analytics by role or user within the module, it leaves you no easy way to exclude individual nodes. Getting the node id (nid) and adding a few extra lines of code that will check against a predefined array results in new code: <?php global $user; // These are the roles, uid, and nid which should not see this module $notallowed_role = array('Administrator','Contributor','Forum admin'); $notallowed_uid = array(1,8); $notallowed_nid = array(1,2,3); // Assume they can see it to start $valid=TRUE; // Go through each ...
Read more

Embedding Google Maps

Recently a client inquired about incorporating a map within their event calendar. For relevant events they already provide the address in a field, so how can we provide the visitors with a navigable map? The robust solution involves combination of Location and GMap modules. But this simple application does not pull complex database location queries, nor is it combining multiple locations onto the map. Effectively, it's a matter of stringing the address field into a Google Maps URL and embedding the iframe. The simple solution assumes you have CCK module ...
Read more

Disable Google Analytics by Role or User

Update: new code to allow excluding individual node as well as roles and users. Google Analytics module allows for tracking by selected roles. What it does not natively provide is a mechanism to exclude specific roles. To disable tracking for a particular role or even a specific user, edit Page specific tracking settings section. Choose Add if the following PHP code returns TRUE and enter the following code, adjusting the role names and the user IDs (uid). This could be also used for control of block displays, when displaying content ...
Read more