forked from deeprapid/angular-respondr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
respondr.js
60 lines (48 loc) · 1.38 KB
/
respondr.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
'use strict';
angular.module('angular-respondr', [])
.service('$respondr', ['$http', '$q', function($http, $q) {
return {
send: function (respondr) {
var q = $q.defer();
$http.post(
"https://9axdd8x726.execute-api.us-east-1.amazonaws.com/prod/send",
respondr
).success(function(response) {
q.resolve(response);
}).error(function(err) {
q.reject(err);
});
return q.promise;
},
trackPageView: function (page) {
_raq.push(['trackPageView', page]);
},
saveContact: function (contact) {
_raq.push(['saveContact', contact]);
},
trackSiteSearch: function (search) {
_raq.push(['trackSiteSearch', search]);
},
trackCategoryView: function (category) {
_raq.push(['trackCategoryView', category]);
},
trackProductView: function (product) {
_raq.push(['trackProductView', product]);
}
trackEvent: function (evt) {
_raq.push(['trackEvent', evt]);
},
addEcommerceItem: function (item) {
_paq.push(['addEcommerceItem', item]);
},
updateEcommerceItem: function (item) {
_raq.push(['updateEcommerceItem', item]);
},
deleteEcommerceItem: function (sku) {
_raq.push(['deleteEcommerceItem', {sku: sku}]);
},
trackEcommerceOrder: function (order) {
_raq.push(['trackEcommerceOrder', order]);
}
};
}]);