afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-06-01 12:02 am

[dw-free] Option to exclude your own visits from your google analytics.

[commit: http://hg.dwscoalition.org/dw-free/rev/635815519516]

http://bugs.dwscoalition.org/show_bug.cgi?id=1186

Oops, missed this file

Patch by [personal profile] exor674.

Files modified:
  • cgi-bin/DW/Setting/ExcludeOwnStats.pm
--------------------------------------------------------------------------------
diff -r 3969f1cbd58a -r 635815519516 cgi-bin/DW/Setting/ExcludeOwnStats.pm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/DW/Setting/ExcludeOwnStats.pm	Sun May 31 23:58:18 2009 +0000
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+#
+# DW::Setting::ExcludeOwnStats
+#
+# LJ::Setting module for excluding self from your own statistics
+#
+# Authors:
+#      Andrea Nall <anall@andreanall.com>
+#
+# Copyright (c) 2009 by Dreamwidth Studios, LLC.
+#
+# This program is free software; you may redistribute it and/or modify it under
+# the same terms as Perl itself.  For a copy of the license, please reference
+# 'perldoc perlartistic' or 'perldoc perlgpl'.
+#
+package DW::Setting::ExcludeOwnStats;
+use base 'LJ::Setting';
+use strict;
+use warnings;
+use LJ::Constants;
+
+sub should_render {
+    my ( $class, $u ) = @_;
+
+    return $u && $u->can_use_page_statistics ? 1 : 0;
+}
+
+sub label {
+    return $_[0]->ml( 'setting.excludeownstats.label' );
+}
+
+sub option {
+    my ( $class, $u, $errs, $args ) = @_;
+
+    my $key = $class->pkgkey;
+
+    my $exclude = $class->get_arg( $args, "exclude" ) || $u->exclude_from_own_stats;
+
+    my $ret = LJ::html_check({
+        name => "${key}exclude",
+        id => "${key}exclude",
+        value => 1,
+        selected => $exclude ? 1 : 0,
+    });
+    $ret .= " <label for='${key}exclude'>" . $class->ml( 'setting.excludeownstats.option' ) . "</label>";
+
+    return $ret;
+}
+
+sub save {
+    my ( $class, $u, $args ) = @_;
+
+    my $val = $class->get_arg( $args, "exclude" ) ? "1" : "0";
+    $u->exclude_from_own_stats( $val );
+
+    return 1;
+}
+
+1;
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org