Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions build-system/global-configs/canary-config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"allow-doc-opt-in": [
"amp-next-page",
"analytics-chunks",
"analytics-chunks-inabox"
],
"allow-doc-opt-in": ["amp-next-page", "analytics-chunks-inabox"],
"allow-url-opt-in": ["pump-early-frame"],
"amp-accordion-display-locking": 0.1,
"canary": 1,
Expand Down Expand Up @@ -34,7 +30,6 @@
"swg-gpay-api": 1,
"swg-gpay-native": 1,
"amp-ad-no-center-css": 0,
"analytics-chunks": 1,
"render-on-idle-fix": 1,
"build-in-chunks": 1,
"visibility-trigger-improvements": 1,
Expand Down
7 changes: 1 addition & 6 deletions build-system/global-configs/prod-config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"allow-doc-opt-in": [
"amp-next-page",
"analytics-chunks",
"analytics-chunks-inabox"
],
"allow-doc-opt-in": ["amp-next-page", "analytics-chunks-inabox"],
"allow-url-opt-in": ["pump-early-frame"],
"canary": 0,
"a4aProfilingRate": 0.01,
Expand Down Expand Up @@ -33,7 +29,6 @@
"swg-gpay-api": 1,
"swg-gpay-native": 1,
"amp-ad-no-center-css": 0,
"analytics-chunks": 1,
"adsense-ptt-exp": 0.1,
"doubleclick-ptt-exp": 0.1
}
2 changes: 1 addition & 1 deletion extensions/amp-analytics/0.1/analytics-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,5 @@ export function isAnalyticsChunksExperimentOn(win) {
if (getMode(win).runtime == 'inabox') {
return isExperimentOn(win, 'analytics-chunks-inabox');
}
return isExperimentOn(win, 'analytics-chunks');
return true;
}
11 changes: 7 additions & 4 deletions extensions/amp-analytics/0.1/test/test-amp-analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
import {installCryptoService} from '../../../../src/service/crypto-impl';
import {installUserNotificationManagerForTesting} from '../../../amp-user-notification/0.1/amp-user-notification';
import {instrumentationServiceForDocForTesting} from '../instrumentation';
import {macroTask} from '../../../../testing/yield';

describes.realWin(
'amp-analytics',
Expand Down Expand Up @@ -397,7 +398,7 @@ describes.realWin(
});
});

it('fills internally provided trigger vars', function () {
it('fills internally provided trigger vars', async function* () {
const analytics = getAnalyticsTag({
'requests': {
'timer':
Expand All @@ -413,7 +414,7 @@ describes.realWin(
'visibility': {'on': 'visible', 'request': 'visible'},
},
});

await macroTask();
return waitForSendRequest(analytics).then(() => {
requestVerifier.verifyRequestMatch(
/https:\/\/e.com\/start=[0-9]+&duration=[0-9]/
Expand Down Expand Up @@ -455,7 +456,7 @@ describes.realWin(
});
});

it('updates requestCount on each request', () => {
it('updates requestCount on each request', async function* () {
const analytics = getAnalyticsTag({
'host': 'example.test',
'requests': {
Expand All @@ -467,6 +468,7 @@ describes.realWin(
{'on': 'visible', 'request': 'pageview2'},
],
});
await macroTask();
return waitForSendRequest(analytics).then(() => {
requestVerifier.verifyRequest('/test1=1');
requestVerifier.verifyRequest('/test2=2');
Expand Down Expand Up @@ -1700,12 +1702,13 @@ describes.realWin(
analytics.getAmpDoc = () => ampdoc;
});

it('Initializes a new Linker.', () => {
it('Initializes a new Linker.', async function* () {
env.sandbox.stub(AnalyticsConfig.prototype, 'loadConfig').resolves({});

const linkerStub = env.sandbox.stub(LinkerManager.prototype, 'init');

analytics.buildCallback();
await macroTask();
return analytics.layoutCallback().then(() => {
expect(linkerStub.calledOnce).to.be.true;
});
Expand Down
9 changes: 9 additions & 0 deletions testing/fake-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ class EventListeners {
const {
addEventListener: originalAdd,
removeEventListener: originalRemove,
postMessage: originalPostMessage,
} = target;
target.addEventListener = function (type, handler, captureOrOpts) {
target.eventListeners.add(type, handler, captureOrOpts);
Expand All @@ -310,6 +311,14 @@ class EventListeners {
originalRemove.apply(target, arguments);
}
};
target.postMessage = function (type) {
const e = new Event('message');
e.data = type;
target.eventListeners.fire(e);
if (originalPostMessage) {
originalPostMessage.apply(target, arguments);
}
};
}

/** Create empty instance. */
Expand Down
6 changes: 0 additions & 6 deletions tools/experiments/experiments-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,6 @@ export const EXPERIMENTS = [
spec: 'https://github.com/ampproject/amphtml/issues/26823',
cleanupIssue: 'https://github.com/ampproject/amphtml/issues/26823',
},
{
id: 'analytics-chunks',
name: 'AMP Analytics Break long tasks to chunks (AMP docs only)',
spec: 'https://github.com/ampproject/amphtml/issues/28435',
cleanupIssue: 'https://github.com/ampproject/amphtml/issues/28435',
},
{
id: 'analytics-chunks-inabox',
name: 'AMP Analytics Break long tasks to chunks (AMP Ads only)',
Expand Down