Skip to content

Introduce analytics-chunks experiment#27605

Merged
zhouyx merged 9 commits intoampproject:masterfrom
zhouyx:chunk-trigger
Apr 20, 2020
Merged

Introduce analytics-chunks experiment#27605
zhouyx merged 9 commits intoampproject:masterfrom
zhouyx:chunk-trigger

Conversation

@zhouyx
Copy link
Copy Markdown
Contributor

@zhouyx zhouyx commented Apr 7, 2020

Chunk by triggers and #loadConfigs and #LinkerManager

On Nokia device, with a config that has 20ish triggers
before
image

after
image

return new AnalyticsConfig(this.element)
.loadConfig()
.then((config) => {
loadConfigDeferred.resolve(config);
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.

Nit: It's generally better to resolve with a promise, instead of thening and resolving with a value. That way, rejected promise state will also be propagated (if it's possible, not sure here).

So, configPromise = new AC(…).loadConfig(); loadConfigDeferred.resolve(configPromise)

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.

Good point! Switched to resolve with a promise.

Copy link
Copy Markdown
Contributor

@micajuine-ho micajuine-ho left a comment

Choose a reason for hiding this comment

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

Thanks for this improvement! These look like some great changes 👍

Comment on lines +99 to +102
if (
this.triggerCount_ < IMMEDIATE_TRIGGER_THRES ||
!isExperimentOn(this.win_, 'analytics-chunks')
) {
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.

Probably worth it to leave a comment about why we want to execute the first IMMEDIATE_TRIGGER_THRES triggers immediately (aka increase active pageview ping).

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.

Added comment

Comment on lines +96 to +101
describes.integration(
'basic pageview chunk',
{
body: `
<script>
// initialize _cid cookie with a CLIENT_ID
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.

Thanks for adding an integration test! :D

@amp-bundle-size amp-bundle-size bot requested a review from estherkim April 14, 2020 21:43
@micajuine-ho micajuine-ho self-requested a review April 15, 2020 17:14
@zhouyx
Copy link
Copy Markdown
Contributor Author

zhouyx commented Apr 17, 2020

Please take a look again. I also chunk cookieWriter and sampleIn method in this PR. Thanks!

@zhouyx
Copy link
Copy Markdown
Contributor Author

zhouyx commented Apr 17, 2020

@micajuine-ho Need your approval again on the bundle size check.

Copy link
Copy Markdown
Contributor

@micajuine-ho micajuine-ho left a comment

Choose a reason for hiding this comment

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

cookieWriter and sampledIn chunking changes LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants