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
9a9ffd8a
Commit
9a9ffd8a
authored
Aug 17, 2013
by
hass
Browse files
Issue #2064389 by hass, ndewhurst: "ga" Object Conflicts with Global
"ga" Function
parent
057567e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
googleanalytics.js
googleanalytics.js
+5
-6
No files found.
googleanalytics.js
View file @
9a9ffd8a
...
...
@@ -10,11 +10,10 @@ $(document).ready(function() {
// Catch the closest surrounding link of a clicked element.
$
(
event
.
target
).
closest
(
"
a,area
"
).
each
(
function
()
{
var
ga
=
Drupal
.
settings
.
googleanalytics
;
// Expression to check for special links like gotwo.module /go/* links.
var
isInternalSpecial
=
new
RegExp
(
"
(
\
/go
\
/.*)$
"
,
"
i
"
);
// Expression to check for download links.
var
isDownload
=
new
RegExp
(
"
\\
.(
"
+
ga
.
trackDownloadExtensions
+
"
)$
"
,
"
i
"
);
var
isDownload
=
new
RegExp
(
"
\\
.(
"
+
Drupal
.
settings
.
google_analytics
.
trackDownloadExtensions
+
"
)$
"
,
"
i
"
);
// Is the clicked URL internal?
if
(
isInternal
.
test
(
this
.
href
))
{
...
...
@@ -23,7 +22,7 @@ $(document).ready(function() {
// Do nothing here. The custom event will handle all tracking.
}
// Is download tracking activated and the file extension configured for download tracking?
else
if
(
ga
.
trackDownload
&&
isDownload
.
test
(
this
.
href
))
{
else
if
(
Drupal
.
settings
.
google_analytics
.
trackDownload
&&
isDownload
.
test
(
this
.
href
))
{
// Download link clicked.
var
extension
=
isDownload
.
exec
(
this
.
href
);
ga
(
"
send
"
,
"
event
"
,
"
Downloads
"
,
extension
[
1
].
toUpperCase
(),
this
.
href
.
replace
(
isInternal
,
''
));
...
...
@@ -34,12 +33,12 @@ $(document).ready(function() {
}
}
else
{
if
(
ga
.
trackMailto
&&
$
(
this
).
is
(
"
a[href^='mailto:'],area[href^='mailto:']
"
))
{
if
(
Drupal
.
settings
.
google_analytics
.
trackMailto
&&
$
(
this
).
is
(
"
a[href^='mailto:'],area[href^='mailto:']
"
))
{
// Mailto link clicked.
ga
(
"
send
"
,
"
event
"
,
"
Mails
"
,
"
Click
"
,
this
.
href
.
substring
(
7
));
}
else
if
(
ga
.
trackOutbound
&&
this
.
href
.
match
(
/^
\w
+:
\/\/
/i
))
{
if
(
ga
.
trackDomainMode
==
2
&&
isCrossDomain
(
this
.
hostname
,
ga
.
trackCrossDomains
))
{
else
if
(
Drupal
.
settings
.
google_analytics
.
trackOutbound
&&
this
.
href
.
match
(
/^
\w
+:
\/\/
/i
))
{
if
(
Drupal
.
settings
.
google_analytics
.
trackDomainMode
==
2
&&
isCrossDomain
(
this
.
hostname
,
Drupal
.
settings
.
google_analytics
.
trackCrossDomains
))
{
// Top-level cross domain clicked. document.location is handled by _link internally.
event
.
preventDefault
();
// @todo: unknown upgrade path
...
...
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