@dpgradio/creative 7.0.6 → 7.6.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/analytics/mixpanel.js +35 -0
- package/src/index.js +7 -1
- package/package-lock.json +0 -3891
- /package/src/{privacy → analytics}/dataLayer.js +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { privacy } from '../privacy/privacy'
|
|
2
|
+
|
|
3
|
+
class Mixpanel {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.trackingEvents = false
|
|
6
|
+
this.trackBacklog = []
|
|
7
|
+
this.mixpanel = null
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
initialize(Mixpanel, { mixpanelId, track_pageview = true }) {
|
|
11
|
+
this.mixpanel = Mixpanel
|
|
12
|
+
privacy.push('analytics', () => {
|
|
13
|
+
this.mixpanel.init(mixpanelId, {
|
|
14
|
+
track_pageview,
|
|
15
|
+
persistence: 'localStorage',
|
|
16
|
+
api_host: 'https://api-eu.mixpanel.com',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
while (this.trackBacklog.length > 0) {
|
|
20
|
+
const { eventName, properties } = this.trackBacklog.shift()
|
|
21
|
+
this.mixpanel.track(eventName, properties)
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
trackEvent(eventName, properties) {
|
|
27
|
+
if (this.trackingEvents) {
|
|
28
|
+
this.mixpanel.track(eventName, properties)
|
|
29
|
+
} else {
|
|
30
|
+
this.trackBacklog.push({ eventName, properties })
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default new Mixpanel()
|
package/src/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
export { default as hybrid } from './app/hybrid.js'
|
|
2
2
|
|
|
3
|
+
// Privacy
|
|
3
4
|
export { default as privacy } from './privacy/privacy.js'
|
|
4
|
-
export { default as dataLayer } from './privacy/dataLayer.js'
|
|
5
5
|
|
|
6
|
+
// Analytics
|
|
7
|
+
export { default as dataLayer } from './analytics/dataLayer.js'
|
|
8
|
+
export { default as mixpanel } from './analytics/mixpanel.js'
|
|
9
|
+
|
|
10
|
+
// Websocket
|
|
6
11
|
export { default as socket } from './socket/socket.js'
|
|
7
12
|
|
|
8
13
|
export { default as configuration, config } from './config/config.js'
|
|
@@ -11,6 +16,7 @@ export { default as api } from './api/api.js'
|
|
|
11
16
|
|
|
12
17
|
export { default as authentication } from './app/authentication.js'
|
|
13
18
|
|
|
19
|
+
// Utils
|
|
14
20
|
export { default as loadScript } from './utils/loadScript.js'
|
|
15
21
|
export { default as openLink } from './utils/openLink.js'
|
|
16
22
|
export { default as openExternalUrl } from './utils/openExternalUrl.js'
|