fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a18466c
)
Add campaign custom dimension to donation form.
author
Radek Czajka
<rczajka@rczajka.pl>
Tue, 27 Apr 2021 09:21:52 +0000
(11:21 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Tue, 27 Apr 2021 09:21:52 +0000
(11:21 +0200)
src/club/static/club/form.js
patch
|
blob
|
history
diff --git
a/src/club/static/club/form.js
b/src/club/static/club/form.js
index
f590fdf
..
422cab4
100644
(file)
--- a/
src/club/static/club/form.js
+++ b/
src/club/static/club/form.js
@@
-18,7
+18,18
@@
$(function() {
$("#payment-form .plan").change(update_methods);
$("#payment-form .plan").change(update_methods);
+ function qs(key) {
+ key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars
+ var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)"));
+ return match && decodeURIComponent(match[1].replace(/\+/g, " "));
+ }
+
$("#payment-form").submit(function() {
$("#payment-form").submit(function() {
- _paq.push(['trackGoal', 12, parseFloat($("#id_amount").val())]);
+ let camp = qs('pk_campaign');
+ if (!camp && window.location.pathname !== "/towarzystwo/") {
+ camp = window.location.pathname;
+ }
+ let dims = camp ? {dimension2: camp} : {};
+ _paq.push(['trackGoal', 12, parseFloat($("#id_amount").val()), dims]);
});
});
});
});