Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item12552: added tracking of outlinks and downloads
git-svn-id: http://svn.foswiki.org/trunk/PiwikPlugin@16844 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
- Loading branch information
MichaelDaum
authored and
MichaelDaum
committed
Jul 18, 2013
1 parent
f9dea39
commit e4930e5
Showing
7 changed files
with
207 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,6 @@ sub new { | |
$this->writeDebug("using queueDir $this->{queueDir}"); | ||
} | ||
|
||
|
||
return $this; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FOSWIKI_ROOT?=~/foswiki/trunk/core | ||
TARGET=jquery.piwik.js | ||
|
||
-include $(FOSWIKI_ROOT)/pub/System/JQueryPlugin/Makefile.include | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
jQuery(function($) { | ||
var baseUrl = location.protocol + "//" + location.hostname + (location.port && ":" + location.port), | ||
pubUrl = foswiki.getPreference("PUBURL"), | ||
pubUrlPath = foswiki.getPreference("PUBURLPATH"), | ||
trackActionUrl = foswiki.getPreference("SCRIPTURL")+"/rest/PiwikPlugin/doTrackAction"; | ||
|
||
$(document).on("click", "a", function() { | ||
var $this = $(this), | ||
href = $this.attr("href"); | ||
|
||
if (typeof(href) !== 'undefined') { | ||
|
||
// is it an outgoing link? | ||
if (href.indexOf("http") == 0 && href.indexOf(baseUrl) != 0) { | ||
|
||
//console.log("external url clicked",href); | ||
|
||
// record it | ||
$.ajax({ | ||
url: trackActionUrl, | ||
async: false, | ||
data: { | ||
"action": "link", | ||
"url": href | ||
} | ||
}); | ||
} | ||
|
||
// is it a link to an attachment? | ||
if (href.indexOf(pubUrl) == 0 || href.indexOf(pubUrlPath) == 0) { | ||
|
||
if (href.indexOf("/") == 0) { | ||
href = baseUrl+href; | ||
} | ||
//console.log("attachment clicked", href); | ||
|
||
// record it | ||
$.ajax({ | ||
url: trackActionUrl, | ||
async: false, | ||
data: { | ||
"action": "download", | ||
"url": href | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
}); |