Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
google_analytics
Commits
a47ef8fa
Commit
a47ef8fa
authored
Oct 06, 2013
by
hass
Browse files
DX: Renamed getInternalUrl() to getPageUrl()
parent
b64bce0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
googleanalytics.debug.js
googleanalytics.debug.js
+4
-4
googleanalytics.js
googleanalytics.js
+4
-4
No files found.
googleanalytics.debug.js
View file @
a47ef8fa
...
...
@@ -30,10 +30,10 @@ console.log("Check if base_url + '/go/foo' url is internal special. Expected: tr
console
.
log
(
"
Check if base_url + '/node/1' url is internal special. Expected: false, Result: %s.
"
,
Drupal
.
googleanalytics
.
isInternalSpecial
(
base_url
+
'
/node/1
'
));
console
.
groupEnd
();
console
.
group
(
"
Test 'get
Internal
Url':
"
);
console
.
log
(
"
Get absolute internal url from full qualified url. Expected: '/node/1', Result: '%s'.
"
,
Drupal
.
googleanalytics
.
get
Internal
Url
(
base_url
+
'
/node/1
'
));
console
.
log
(
"
Get absolute internal url from absolute url. Expected: '/node/1', Result: '%s'.
"
,
Drupal
.
googleanalytics
.
get
Internal
Url
(
'
/node/1
'
));
console
.
log
(
"
Get full qualified external url. Expected: 'http://example.com/node/2', Result: '%s'.
"
,
Drupal
.
googleanalytics
.
get
Internal
Url
(
'
http://example.com/node/2
'
));
console
.
group
(
"
Test 'get
Page
Url':
"
);
console
.
log
(
"
Get absolute internal url from full qualified url. Expected: '/node/1', Result: '%s'.
"
,
Drupal
.
googleanalytics
.
get
Page
Url
(
base_url
+
'
/node/1
'
));
console
.
log
(
"
Get absolute internal url from absolute url. Expected: '/node/1', Result: '%s'.
"
,
Drupal
.
googleanalytics
.
get
Page
Url
(
'
/node/1
'
));
console
.
log
(
"
Get full qualified external url. Expected: 'http://example.com/node/2', Result: '%s'.
"
,
Drupal
.
googleanalytics
.
get
Page
Url
(
'
http://example.com/node/2
'
));
console
.
groupEnd
();
console
.
group
(
"
Test 'getDownloadExtension':
"
);
...
...
googleanalytics.js
View file @
a47ef8fa
...
...
@@ -20,11 +20,11 @@ $(document).ready(function() {
// Is download tracking activated and the file extension configured for download tracking?
else
if
(
Drupal
.
settings
.
googleanalytics
.
trackDownload
&&
Drupal
.
googleanalytics
.
isDownload
(
this
.
href
))
{
// Download link clicked.
ga
(
"
send
"
,
"
event
"
,
"
Downloads
"
,
Drupal
.
googleanalytics
.
getDownloadExtension
(
this
.
href
).
toUpperCase
(),
Drupal
.
googleanalytics
.
get
Internal
Url
(
this
.
href
));
ga
(
"
send
"
,
"
event
"
,
"
Downloads
"
,
Drupal
.
googleanalytics
.
getDownloadExtension
(
this
.
href
).
toUpperCase
(),
Drupal
.
googleanalytics
.
get
Page
Url
(
this
.
href
));
}
else
if
(
Drupal
.
googleanalytics
.
isInternalSpecial
(
this
.
href
))
{
// Keep the internal URL for Google Analytics website overlay intact.
ga
(
"
send
"
,
"
pageview
"
,
{
page
:
Drupal
.
googleanalytics
.
get
Internal
Url
(
this
.
href
)
});
ga
(
"
send
"
,
"
pageview
"
,
{
page
:
Drupal
.
googleanalytics
.
get
Page
Url
(
this
.
href
)
});
}
}
else
{
...
...
@@ -55,7 +55,7 @@ $(document).ready(function() {
$
(
document
).
bind
(
"
cbox_complete
"
,
function
()
{
var
href
=
$
.
colorbox
.
element
().
attr
(
"
href
"
);
if
(
href
)
{
ga
(
"
send
"
,
"
pageview
"
,
{
page
:
Drupal
.
googleanalytics
.
get
Internal
Url
(
href
)
});
ga
(
"
send
"
,
"
pageview
"
,
{
page
:
Drupal
.
googleanalytics
.
get
Page
Url
(
href
)
});
}
});
...
...
@@ -138,7 +138,7 @@ Drupal.googleanalytics.isInternalSpecial = function (url) {
* @return string
* Internal website URL
*/
Drupal
.
googleanalytics
.
get
Internal
Url
=
function
(
url
)
{
Drupal
.
googleanalytics
.
get
Page
Url
=
function
(
url
)
{
var
extractInternalUrl
=
new
RegExp
(
"
^(https?):
\
/
\
/
"
+
window
.
location
.
host
,
"
i
"
);
return
url
.
replace
(
extractInternalUrl
,
''
);
}
...
...
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