As I posted on this “warm-up” post I am running my personal blog using Telligent Graffiti CMS, main reason: I like telligent’s products and approach, and I wanted to test this product of them on my shoulder.
I am very happy about it, set it ip and customezed it very quickly; the bad thing is that its future is not clear yet (is it sometime it is not updated). Anyhow, for the time been, I keep using it and sometime I need to implement some changes.
This time I wanted to stop Google analytics, which I implemented on the site, to track my own site access (or generally speaking, any access from an administrator)
To accomplish this, I found this article by google “How do I exclude my internal traffic from reports?” , which reports how to set-up a custom filter to exclude traffic coming with special conditions.
Among this, there is the option to set a variable, using a JavaScript call
pageTracker._setVar(‘siteadmin_access’);
This variable is set within the Analytics cookie, which last for some time (but since cookie can be reset, I wanted to be set for all admin sessions)
Having understood that, I then needed to define how, within Graffiti CMS, to execute this javascript call: it needs to be executed only from the users which I wanted to exclude.
I then went through the “Graffiti CMS” official documentation (read: I went through someone else code to find out stuff similar to mine 🙂
The result is the following: to modify the layout page of the theme you are using (in my case SleepyBlue) which can be found here: Home > files >themes > SleepyBlue > layout.view
On the bottom of the page, befor the </html> closure, I added the following code:
#if ($macros.IsNotNull($user))
#if($macros.CanViewControlPanel($user))
<script type="text/javascript">pageTracker._setVar(‘siteadmin_access’);</script>
#end
#end
Note: Since this call needs the pageTracker object to be instantiated, it require the Analytics call to he executed before.
Within Graffitics CMS, there is a specific call to include a generic analytics plug in, which is:
$!data.Site.WebStatistics
This call, in my customized-theme case, is called within the <head> section of the page.
(if you’re wondering where the Goolge js need to be defined in graffiti: go to the “Control Panel > Site Options > Settings > Web Statistics”)
Now all I needed to to, is from the Analytics Settings to create a filter:
From the Analytics Profile, add a new Filter.
Using IE8 Developer Toolbar, I verified that the cookie was corretly setup
As you can see, the cookie expires is in two year 🙂
HTH,
Alberto
Keep working ,great activity!