Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.

Commit 4d2d52f

Browse files
committed
Merge pull request #245 from erantapaa/master
Add Google Analytics tracking
2 parents 86c2097 + 4ae21a6 commit 4d2d52f

File tree

3 files changed

+92
-7
lines changed

3 files changed

+92
-7
lines changed

new-platform.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/sh
2+
#
3+
# There are two ways to invoke this script:
4+
#
5+
# 1) ./platform.sh GHC_BINDIST CABAL STACK build-all
6+
#
7+
# 2) Create the file config.platform with the contents:
8+
#
9+
# GHC_BINDIST=...
10+
# CABAL=...
11+
# STACK=...
12+
#
13+
# and then run this script as:
14+
#
15+
# ./platform.sh build-all
16+
#
17+
set -e
18+
19+
HPTOOL=hptool/dist/build/hptool/hptool
20+
HPTOOL_ALT=hptool/.cabal-sandbox/bin/hptool
21+
22+
if ( cabal sandbox --help >/dev/null 2>&1 ) ; then
23+
if [ \! -d hptool/.cabal-sandbox ]
24+
then
25+
echo '***'
26+
echo '*** Setting up sandbox for hptool'
27+
echo '***'
28+
cabal update
29+
(cd hptool; cabal sandbox init; cabal install --only-dependencies)
30+
fi
31+
else
32+
if ( cabal install --dry-run --only-dependencies | grep -q 'would be installed' ) ; then
33+
echo '=== pre-requisite packages for hptool are not installed'
34+
echo ' run the following:'
35+
echo ' cd hptool ; cabal install --only-dependencies'
36+
exit 1
37+
fi
38+
fi
39+
40+
echo '***'
41+
echo '*** Building hptool'
42+
echo '***'
43+
(cd hptool; cabal build)
44+
45+
if [ "$HPTOOL_ALT" -nt "$HPTOOL" ] ; then
46+
HPTOOL="$HPTOOL_ALT"
47+
fi
48+
49+
SCRIPT=$(readlink -f "$0")
50+
SCRIPT_DIR=$(dirname "$SCRIPT")
51+
CONFIG_PATH="$SCRIPT_DIR/config.platform"
52+
53+
echo '***'
54+
echo '*** Running hptool'
55+
echo '***'
56+
if [ -e "$CONFIG_PATH" ]; then
57+
echo "=== sourcing $CONFIG_PATH"
58+
. "$CONFIG_PATH"
59+
ok="1"
60+
if [ -z "$STACK" ]; then echo "STACK is not set"; ok=""; fi
61+
if [ -z "$CABAL" ]; then echo "CABAL is not set"; ok=""; fi
62+
if [ -z "$GHC_BINDIST" ]; then echo "GHC_BINDIST is not set"; ok=""; fi
63+
if [ -z "$ok" ]; then
64+
echo "config not complete: " $CONFIG_PATH
65+
else
66+
echo "*** Using parameters from $CONFIG_PATH"
67+
exec $HPTOOL "$GHC_BINDIST" "$CABAL" "$STACK" "$@"
68+
fi
69+
else
70+
exec $HPTOOL "$@"
71+
fi
72+

website/templates/plan-a/download-os-sections.html.mu

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@
8989
{{#current}} {{#files}} {{#isOSX}}
9090
{{#isFull}}
9191
<div class="download-btn">
92-
<a href="{{> downloads-root}}{{url}}" class="btn btn-haskell" role="button">
92+
<a href="{{> downloads-root}}{{url}}" onclick="return dl(this)" class="btn btn-haskell" role="button">
9393
<i class="fa fa-download"></i> Download Full ({{archBits}} bit)
9494
</a>
9595
</div>
9696
{{/isFull}}
9797
{{^isFull}}
9898
<div class="download-btn">
99-
<a href="{{> downloads-root}}{{url}}" class="btn btn-haskell" role="button">
99+
<a href="{{> downloads-root}}{{url}}" onclick="return dl(this)" class="btn btn-haskell" role="button">
100100
<i class="fa fa-download"></i> Download Minimal ({{archBits}} bit)
101101
</a>
102102
</div>
@@ -174,14 +174,14 @@
174174
{{#current}} {{#files}} {{#isWindows}}
175175
{{#isFull}}
176176
<div class="download-btn">
177-
<a href="{{> downloads-root}}{{url}}" class="btn btn-haskell" role="button">
177+
<a href="{{> downloads-root}}{{url}}" onclick="return dl(this)" class="btn btn-haskell" role="button">
178178
<i class="fa fa-download"></i> Download Full ({{archBits}} bit)
179179
</a>
180180
</div>
181181
{{/isFull}}
182182
{{^isFull}}
183183
<div class="download-btn">
184-
<a href="{{> downloads-root}}{{url}}" class="btn btn-haskell" role="button">
184+
<a href="{{> downloads-root}}{{url}}" onclick="return dl(this)" class="btn btn-haskell" role="button">
185185
<i class="fa fa-download"></i> Download Minimal ({{archBits}} bit)
186186
</a>
187187
</div>
@@ -293,14 +293,14 @@ extra-include-dirs: C:\Program Files\Haskell Platform\8.0.1\mingw\include
293293
{{#current}} {{#files}} {{#isLinux}}
294294
{{#isFull}}
295295
<div class="download-btn">
296-
<a href="{{> downloads-root}}{{url}}" class="btn btn-haskell" role="button">
296+
<a href="{{> downloads-root}}{{url}}" onclick="return dl(this)" class="btn btn-haskell" role="button">
297297
<i class="fa fa-download"></i> Download Full ({{archBits}} bit)
298298
</a>
299299
</div>
300300
{{/isFull}}
301301
{{^isFull}}
302302
<div class="download-btn">
303-
<a href="{{> downloads-root}}{{url}}" class="btn btn-haskell" role="button">
303+
<a href="{{> downloads-root}}{{url}}" onclick="return dl(this)" class="btn btn-haskell" role="button">
304304
<i class="fa fa-download"></i> Download Minimal ({{archBits}} bit)
305305
</a>
306306
</div>
@@ -407,7 +407,7 @@ $ sudo emerge haskell-platform</pre>
407407
<p>Download and extract the source tarball,</p>
408408
{{#current}} {{#files}} {{#isSource}}
409409
<div class="download-btn">
410-
<a href="{{> downloads-root}}{{url}}" class="btn btn-haskell" role="button">
410+
<a href="{{> downloads-root}}{{url}}" onclick="return dl(this)" class="btn btn-haskell" role="button">
411411
<i class="fa fa-download"></i> Download
412412
</a>
413413
</div>

website/templates/plan-a/footer.mu

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,16 @@
1313
</p>
1414
</div>
1515
</div>
16+
<script>
17+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
18+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
19+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
20+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
21+
22+
ga('create', 'UA-51440536-1', 'auto');
23+
ga('send', 'pageview');
24+
function dl(me) {
25+
ga('send','event',{eventCategory:'Download', eventAction:'Download HP', eventLabel:me.href})
26+
return true
27+
}
28+
</script>

0 commit comments

Comments
 (0)