Skip to content

✨[amp-analytics] Session Count for Session Analytics#34850

Merged
micajuine-ho merged 15 commits intoampproject:mainfrom
micajuine-ho:session_count
Jun 23, 2021
Merged

✨[amp-analytics] Session Count for Session Analytics#34850
micajuine-ho merged 15 commits intoampproject:mainfrom
micajuine-ho:session_count

Conversation

@micajuine-ho
Copy link
Copy Markdown
Contributor

Partial for #33990

@micajuine-ho micajuine-ho requested a review from alanorozco June 22, 2021 16:02
@micajuine-ho micajuine-ho marked this pull request as ready for review June 22, 2021 16:02
updateSession_(session) {
if (isSessionExpired(session)) {
const newSessionCount =
session.count === undefined ? 1 : session.count + 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which cases would session.count be undefined?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only in the rare case of a user using session analytics before this PR comes out.

@micajuine-ho
Copy link
Copy Markdown
Contributor Author

cc @ampproject/wg-performance Can I get a approval for bundle size check?

/**
* @param {SessionInfoDef|string} storedSession
* @return {SessionInfoDef|undefined}
* @param {*} storedSession
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When might this be of a different type?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the type we get back from storage-impl/get(). I imagine it has to do with the fact that we can't guarantee that no one will tamper with LS.

Copy link
Copy Markdown
Contributor

@rcebulko rcebulko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a couple comments but approving for bundle-size

Co-authored-by: Ryan Cebulko <ryan@cebulko.com>
@micajuine-ho micajuine-ho merged commit 8aff9c5 into ampproject:main Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants