-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathangulartics.angular.txt
88 lines (78 loc) · 6.41 KB
/
angulartics.angular.txt
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
┏━━━━━━━━━━━━━━━━━┓
┃ ANGULARTICS ┃
┗━━━━━━━━━━━━━━━━━┛
VERSION ==> #0.17.2
#Google Analytics (or other vendors) for Angular.
#Components:
# - MODULE "angulartics" + "angulartics.VENDOR", where VENDOR can be:
# google.analytics[.cordova], debug, google.tagmanager, chartbeat, flurry,
# adobe.analytics, kissmetrics, mixpanel, piwik, segment.io, splunk, woopra, baidu,
# cnzz, hubspot, intercom, localytics, loggly, marketo, mixpanel
# - SERVICE $analytics
# - PROVIDER $analyticsProvider
MODULES ==> #Following methods depends on VENDOR:
# - each VENDOR is a MODULE "angulartics.SERVICE" which should call
# ANALYTICSPROVIDER.register*(FUNC(...)) to define what ANALYTICS.*(...) does,
# e.g. ANALYTICSPROVIDER.registerPageTrack(FUNC(URL))
# - can register several VENDOR, which will all be fired.
# - if VENDOR is created async:
# - can call (global variable) angulartics.waitForVendorApi
# (VAR_STR, POLLING_NUM[, VAR2_STR], FUNC(window.VAR))
# FUNC(...) will fire once window.VAR[.VAR2] is not undefined.
# Should wrap ANALYTICSPROVIDER.register*()
# - meanwhile calls to ANALYTICS.* are buffered:
# will call them in order, with an interval of
# ANALYTICSPROVIDER.settings.bufferFlushDelay NUM (def: 1000)
ANALYTICS.pageTrack(URL,$location)#Add tracking event on page changes
ANALYTICS.eventTrack(STR[, OBJ]) #Add tracking event not on page changes. this is the current element.
ANALYTICS.setAlias|Username(STR) #Sets the user id
ANALYTICS.setUser|SuperProperties
[Once](...) #Sets the user metadata
ANALYTICSPROVIDER.virtualPageviews#If true (def), fires ANALYTICS.pageTrack(AURL, $location) when changing AURL.
(BOOL) #AURL:
# - is preceded by:
# - <base> href if ANALYTICSPROVIDER.withBase(true)
# - WINDOW.location.pathname + "#" (i.e. the real path) if
# ANALYTICSPROVIDER.withAutoBase(BOOL) true (def: false)
# - watches $route|stateChangeSuccess, so works with both Angular $routeProvider and
# UI Router. With $routeProvider, do not track if ROUTE.redirectTo
ANALYTICSPROVIDER.firstPageview #Same for pages with no $routeProvider nor UI router (def: true), except:
(BOOL) # - AURL can be full URL if ANALYTICSPROVIDER.settings.trackRelativePath false (def)
<any> #Calls ANALYTICS.eventTrack(STR, OBJ) when EVENT (def: "click") arises
analytics-on[="EVENT"] #STR is by def: ELEM.id|value, textContent
analytics-event="STR" # - if <a> or <button|input type="submit|button">, textContent or (if empty) ELEM.value
analytics-VAR="STR2" # - otherwise ELEM.id|name|tagName
analytics-properties="OBJ2_EXPR"#OBJ:
analytics-if="BOOL_EXPR" # - VAR: STR2
# - eventType: EVENT
# - merged with OBJ2.VAR STR2
#Do nothing if BOOL false
#EVENT can be "scrollby":
# - first time the element is on top of viewport (or passed it)
# - MODULE "angulartics.scroll"
# - based on Waypoints (must load it).
# Can add DIRECTIVE scrollby-VAR[="VAL"], which will add option OBJ.VAR VAL (def: true)
# to new Waypoint(OBJ).
# Def. OBJ: { continuous: false, triggerOnce: true }
ANALYTICSPROVIDER.developerMode
(BOOL) #If true, ANALYTICS.*() will be noop
┌─────────────┐
│ MODULES │
└─────────────┘
GOOGLE ANALYTICS ==> # - must remove ga("send","pageview") from Google Analytics snippet
# - ANALYTICS.pageTrack(URL):
# - calls ga("send", "pageview", URL)
# - ANALYTICS.eventTrack(STR, OBJ):
# - calls ga("send", "event", OBJ2), where OBJ2:
# - eventAction STR
# - eventCategory|Label|Value|nonInteraction: OBJ.category|label|value|noninteraction
# - dimension|metric1-20: OBJ.dimension|metric1-20
# - ANALYTICS.setUsername(USERID) or ANALYTICSPROVIDER.settings.ga.userId USERID, if not
# null:
# - calls ga("set", "&uid", USERID) before ga("send", "pageview", URL)
# - use OBJ2.userId USERID in ga("send", "event", OBJ2)
# - if ANALYTICSPROVIDER.settings.ga.additionalAccountNames STR_ARR, do extra
# ga("STR.send", ...) after each ga("send", ...)
# - sets ANALYTICSPROVIDER.settings.trackRelativePath true
GOOGLE ANALYTICS CORDOVA ==> #Waits for "deviceReady" event (or 3 secs). TO DO (there are two plugins in source code)
DEBUG ==> # - ANALYTICS.page|eventTrack(...) -> console.log(...)