Skip to content

Instantly share code, notes, and snippets.

@rtripault
Created February 25, 2011 07:33
Show Gist options
  • Save rtripault/843478 to your computer and use it in GitHub Desktop.
Save rtripault/843478 to your computer and use it in GitHub Desktop.
Load analytics tracking code (if user is logged in or not) for MODx Revolution (source: http://modxcms.com/forums/index.php/topic,61561.0.html)
<?php
// Gets the analytics if the person is not logged in
// Must call un-cached.
// [[!Get_Analytics]]
$return = '';
$viewer_logged_in = false;
$viewer = $modx->user;
if( $viewer->get('id') != null )
$viewer_logged_in = true;
if($viewer_logged_in == false)
{
$return = 'Put your analytics here, but you will have to escape the apostrophes \' .';
}
else
{
$return = 'You Are Logged In';
}
return $return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment