Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
c84e3c00
Commit
c84e3c00
authored
Oct 26, 2017
by
Patrick O'Carroll
Committed by
Torkel Ödegaard
Oct 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted analytics.js to ts, minor code formatting fix to timer.ts (#9663)
parent
a7d7f0d9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
41 deletions
+36
-41
public/app/core/services/analytics.js
+0
-41
public/app/core/services/analytics.ts
+36
-0
public/app/core/services/timer.ts
+0
-0
No files found.
public/app/core/services/analytics.js
deleted
100644 → 0
View file @
a7d7f0d9
define
([
'angular'
,
'jquery'
,
'app/core/core_module'
,
'app/core/config'
,
],
function
(
angular
,
$
,
coreModule
,
config
)
{
'use strict'
;
config
=
config
.
default
;
coreModule
.
default
.
service
(
'googleAnalyticsSrv'
,
function
(
$rootScope
,
$location
)
{
function
gaInit
()
{
$
.
getScript
(
'https://www.google-analytics.com/analytics.js'
);
// jQuery shortcut
var
ga
=
window
.
ga
=
window
.
ga
||
function
()
{
(
ga
.
q
=
ga
.
q
||
[]).
push
(
arguments
);
};
ga
.
l
=
+
new
Date
;
ga
(
'create'
,
config
.
googleAnalyticsId
,
'auto'
);
return
ga
;
}
this
.
init
=
function
()
{
$rootScope
.
$on
(
'$viewContentLoaded'
,
function
()
{
var
track
=
{
page
:
$location
.
url
()
};
var
ga
=
window
.
ga
||
gaInit
();
ga
(
'set'
,
track
);
ga
(
'send'
,
'pageview'
);
});
};
}).
run
(
function
(
googleAnalyticsSrv
)
{
if
(
config
.
googleAnalyticsId
)
{
googleAnalyticsSrv
.
init
();
}
});
});
public/app/core/services/analytics.ts
0 → 100644
View file @
c84e3c00
import
$
from
'jquery'
;
import
coreModule
from
'app/core/core_module'
;
import
config
from
'app/core/config'
;
export
class
Analytics
{
/** @ngInject */
constructor
(
private
$rootScope
,
private
$location
)
{
}
gaInit
()
{
$
.
getScript
(
'https://www.google-analytics.com/analytics.js'
);
// jQuery shortcut
var
ga
=
(
<
any
>
window
).
ga
=
(
<
any
>
window
).
ga
||
function
()
{
(
ga
.
q
=
ga
.
q
||
[]).
push
(
arguments
);
};
ga
.
l
=
+
new
Date
;
ga
(
'create'
,
(
<
any
>
config
).
googleAnalyticsId
,
'auto'
);
return
ga
;
}
init
()
{
this
.
$rootScope
.
$on
(
'$viewContentLoaded'
,
()
=>
{
var
track
=
{
page
:
this
.
$location
.
url
()
};
var
ga
=
(
<
any
>
window
).
ga
||
this
.
gaInit
();
ga
(
'set'
,
track
);
ga
(
'send'
,
'pageview'
);
});
}
}
/** @ngInject */
function
startAnalytics
(
googleAnalyticsSrv
)
{
if
((
<
any
>
config
).
googleAnalyticsId
)
{
googleAnalyticsSrv
.
init
();
}
}
coreModule
.
service
(
'googleAnalyticsSrv'
,
Analytics
).
run
(
startAnalytics
);
public/app/core/services/timer.ts
View file @
c84e3c00
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment