Skip to content

Commit

Permalink
Merge pull request #352 from cofacts/add-userid-in-bq
Browse files Browse the repository at this point in the history
Add userid in bq analytics
  • Loading branch information
MrOrz committed May 19, 2023
2 parents afa6679 + 0911382 commit 427511a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lib/__tests__/ga.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ it('returns visitor', () => {
"extra": "{}",
"messageSource": "user",
"text": "",
"userId": "userId",
},
],
]
Expand Down Expand Up @@ -109,6 +110,7 @@ it('sets title when title is given', () => {
"events": Array [],
"extra": "{}",
"messageSource": "room",
"userId": "userId",
}
`);
// Expect title is sent to BigQuery
Expand Down Expand Up @@ -160,6 +162,7 @@ it('sets events', () => {
"extra": "{}",
"messageSource": "user",
"text": "",
"userId": "userId",
},
],
]
Expand Down
2 changes: 2 additions & 0 deletions src/lib/ga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ export default function ga(
});
return visitor.event(evt);
},

send() {
insertEventBatch({
userId: uuid,
text: documentTitle,
messageSource,
events,
Expand Down
1 change: 1 addition & 0 deletions src/lineContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ lineContentRouter.get('/', async (ctx) => {
visitor.send();

insertEventBatch({
userId: null,
createdAt: new Date(),
text: null,
messageSource: null,
Expand Down
2 changes: 1 addition & 1 deletion src/rumors-db

0 comments on commit 427511a

Please sign in to comment.