Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
54 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Please define your Google Analytics ID as GOOGLE_ANALYTICS_ID in the variable database | ||
of your production system. |
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,34 @@ | ||
UserTag google_analytics Order function code | ||
UserTag google_analytics Routine <<EOR | ||
sub { | ||
my ($function, $code) = @_; | ||
my (@trans, $set, $out); | ||
|
||
return unless $function eq 'transaction'; | ||
|
||
$Tag->perl({tables => 'transactions orderline'}); | ||
|
||
# transaction details | ||
@trans = $Db{transactions}->get_slice($code, [qw/affiliate total_cost salestax shipping city state country/]); | ||
unshift(@trans, $code); | ||
|
||
$out = q{pageTracker._addTrans( | ||
} . join(",\n", map {$Tag->jsqn("$_")} @trans) | ||
. ");\n\n"; | ||
|
||
# orderline entries | ||
$set = $Db{orderline}->query({sql => qq{select order_number,sku,description,'',price,quantity from orderline where order_number = $code}}); | ||
for (@$set) { | ||
$out .= q{pageTracker._addItem( | ||
} . join(",\n", map {$Tag->jsqn($_)} @$_) | ||
. ");\n\n"; | ||
} | ||
|
||
# complete transaction tracking | ||
$out .= q{pageTracker._trackTrans(); | ||
}; | ||
|
||
return $out; | ||
} | ||
EOR | ||
|
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,11 @@ | ||
[if var GOOGLE_ANALYTICS_ID] | ||
<script type="text/javascript"> | ||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | ||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | ||
</script> | ||
<script type="text/javascript"> | ||
var pageTracker = _gat._getTracker("__GOOGLE_ANALYTICS_ID__"); | ||
pageTracker._trackPageview("__PAGEVIEW__[if cgi q]?q=[cgi q][/if]"); | ||
__TRACK__ | ||
</script> | ||
[/if] |
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,3 @@ | ||
name = Google Analytics | ||
version = 1.0 | ||
author = Stefan Hornburg (Racke) <racke@linuxia.de> |
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,4 @@ | ||
Message Loading Google Analytics plugin. | ||
|
||
Variable CURPLUGIN google_analytics | ||
include plugins/default.cfg |