Skip to content

Commit

Permalink
chore: update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidWells committed Feb 12, 2024
1 parent 58b1849 commit 3671ab3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
6 changes: 6 additions & 0 deletions examples/demo/src/tests/analytics.test.js
Expand Up @@ -95,6 +95,12 @@ it('should abort if a plugin aborts', (done) => {
NAMESPACE: 'test-plugin-zero',
track: trackSpy,
},
{
NAMESPACE: 'test-plugin-start',
trackStart: ({ abort }) => {
return abort('stop all other track calls')
},
},
{
NAMESPACE: 'test-plugin',
track: ({ abort }) => {
Expand Down
44 changes: 35 additions & 9 deletions examples/demo/src/utils/analytics/just-ga.js
@@ -1,20 +1,46 @@
import Analytics from 'analytics'
import googleAnalytics from '@analytics/google-analytics'

const validationPlugin = {
NAMESPACE: 'id-plugin-start',
identifyStart: ({ payload, abort }) => {
return abort('Identify traits is the same as previous identify');
}
}

const abortQueueTests = [
validationPlugin,
{
NAMESPACE: 'page-plugin-start',
pageStart: ({ abort }) => {
return abort('stop all other page calls')
},
},
{
NAMESPACE: 'page-plugin',
page: ({ payload, abort }) => {
console.log('abort', abort)
console.log('Run page')
}
}
]

const GaPlugin = [
googleAnalytics({
measurementIds: ['G-RL2P3ZC6B2'],
// gtagConfig: {
// send_page_view: true,
// }
// debug: true
}),
]

/* initialize analytics and load plugins */
const analytics = Analytics({
debug: true,
app: 'yolo',
version: '1.2.0',
plugins: [
googleAnalytics({
measurementIds: ['G-RL2P3ZC6B2'],
// gtagConfig: {
// send_page_view: true,
// }
// debug: true
}),
]
plugins: GaPlugin
})

export default analytics

0 comments on commit 3671ab3

Please sign in to comment.