line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bootylicious::Plugin::GoogleAnalytics; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
652
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
98
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use Mojo::ByteStream 'b'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
246
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub register { |
11
|
1
|
|
|
1
|
1
|
40
|
my ($self, $app, $conf) = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
50
|
|
|
4
|
$conf ||= {}; |
14
|
|
|
|
|
|
|
|
15
|
1
|
50
|
|
|
|
3
|
return unless $conf->{urchin}; |
16
|
1
|
|
|
|
|
2
|
push @{$app->renderer->classes}, __PACKAGE__; |
|
1
|
|
|
|
|
6
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$app->plugins->on( |
19
|
|
|
|
|
|
|
after_dispatch => sub { |
20
|
1
|
|
|
1
|
|
15277
|
my ($c) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1
|
50
|
33
|
|
|
4
|
return unless $c->res->code && $c->res->code == 200; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
30
|
my $body = $c->res->body; |
25
|
1
|
50
|
|
|
|
28
|
return unless $body; |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
5
|
$c->stash(urchin => $conf->{urchin}); |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
19
|
my $ga_script = $c->render_to_string( |
30
|
|
|
|
|
|
|
'template', |
31
|
|
|
|
|
|
|
format => 'html' |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
1651
|
$ga_script = b($ga_script)->encode('UTF-8'); |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
66
|
$body =~ s{ |