-
Notifications
You must be signed in to change notification settings - Fork 560
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rewrite branch] Add analytics as middleware (#2223)
* centralize analytics again - not working attempt to convert to meta key - fixed addCollaborator args - add removeCollaborator reducer with withEvent - Add COLLABORATOR actions - remove invalid comments - remove unused setAccountName and some more comments - trying event queue to add application_opened before preferences are loaded - documented bugs :[ * Update analytics setting when bucket connects * Set initial accountName in Redux init vs. dispatched action * Send index request for preferences * Persist account name properly Co-authored-by: Dennis Snell <dennis.snell@automattic.com>
- Loading branch information
Showing
20 changed files
with
282 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as A from '../action-types'; | ||
import * as T from '../../types'; | ||
|
||
export const withEvent = ( | ||
eventName: string, | ||
eventProperties?: T.JSONSerializable | ||
) => (action) => ({ | ||
...action, | ||
meta: { | ||
...action.meta, | ||
analytics: [ | ||
...(action.meta?.analytics ?? []), | ||
[eventName, eventProperties], | ||
], | ||
}, | ||
}); | ||
|
||
export const recordEvent: A.ActionCreator<A.RecordEvent> = ( | ||
eventName: string, | ||
eventProperties?: T.JSONSerializable | ||
) => | ||
withEvent( | ||
eventName, | ||
eventProperties | ||
)({ | ||
type: 'RECORD_EVENT', | ||
}); |
Oops, something went wrong.