MCPcopy Create free account
hub / github.com/ampproject/amphtml / sampleInTask

Method sampleInTask

extensions/amp-analytics/0.1/amp-analytics.js:738–747  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

736 if (threshold >= 0 && threshold <= 100) {
737 const sampleDeferred = new Deferred();
738 const sampleInTask = () => {
739 const expansionOptions = this.expansionOptions_({}, trigger);
740 const samplePromise = this.expandTemplateWithUrlParams_(
741 sampleOn,
742 expansionOptions
743 )
744 .then((key) => this.cryptoService_.uniform(key))
745 .then((digest) => digest * 100 < threshold);
746 sampleDeferred.resolve(samplePromise);
747 };
748 if (this.isInabox_) {
749 // Chunk in inabox ad leads to activeview regression, handle seperately
750 sampleInTask();

Callers

nothing calls this directly

Calls 5

expansionOptions_Method · 0.95
uniformMethod · 0.80
resolveMethod · 0.80
thenMethod · 0.45

Tested by

no test coverage detected