Skip to content

Render-start analytics event for documents and embeds#7220

Merged
dvoytenko merged 12 commits intoampproject:masterfrom
dvoytenko:fie14-renderstart
Feb 2, 2017
Merged

Render-start analytics event for documents and embeds#7220
dvoytenko merged 12 commits intoampproject:masterfrom
dvoytenko:fie14-renderstart

Conversation

@dvoytenko
Copy link
Copy Markdown
Contributor

@dvoytenko dvoytenko commented Jan 26, 2017

render-start event is emitted by documents and some embeds when it's confirmed that the rendering of the document has been started.


#### Time since created

Provides the time elapsed since the creation of this document or embed.
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.

Needs unit

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.

Tests are coming...

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.

Oh. Wait. You mean unit of time. Got it.

```

#### Embed render start trigger (`"on": "render-start"`)
Use this configuration to fire a request when this document's or a specified embed's receive render-start signal. This
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.

There are some grammatical issues here.

I think what would really help is to start out by describing what an embed (give ad example) and a document is.

this.win = win;

/** @private {boolean} */
this.isRenderStarted_ = false;
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.

Why is this not signal based?

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.

Do you mean you want to apply the same signals instrument to ampdocs as well? That's probably a good idea. Will do.

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.

Probably want some kind of Signable interface

@lannka lannka self-assigned this Jan 31, 2017
/**
* Signals that the document has been started rendering.
* @restricted
*/
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.

any reason why the method is here, and called in style-installer.js?

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.

There's more logical coming to Resources based on this signal.

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.

what kind of logic?
and how should this work in amp-inabox?

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.

I'm working on moving some scheduling here as well.

This should be called and work exactly the same with amp-inabox with one exception: we also want to postMessage render-start which is what you are working on :) Where exactly postMessage belongs in, I'm not sure. I was going to see where you end up putting it. But my first suggestion was to stick it right into amp-inabox.js. That means that we may need a callback from this method, which you can add later if that's what you'd like to do.

}
```

For an embed within a document, the trigger includes a selector to specify the embed element:
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.

do you want to talk about the definition of "embed element"?

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.

+1 this is not clear.

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.

@cramforce @lannka I rewrote this. Please advise if this is better.

return true;
};
signals = {};
adElement.signal = name => {
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.

Not clear why you need to do this.

```

#### Embed render start trigger (`"on": "render-start"`)
Use this configuration to fire a request when the document or a specified embed emit `render-start` signal. This
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.

emits

But I'd consider switching the language to not use our internal name "signal" and just make this a plain event.

}
```

For an embed within a document, the trigger includes a selector to specify the embed element:
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.

+1 this is not clear.

@dvoytenko dvoytenko changed the title WORK IN PROGRESS: Render-start analytics event Render-start analytics event for documents and embeds Feb 2, 2017
@dvoytenko
Copy link
Copy Markdown
Contributor Author

Tests have been added.

@dvoytenko dvoytenko merged commit 12c9c61 into ampproject:master Feb 2, 2017
@dvoytenko dvoytenko deleted the fie14-renderstart branch February 2, 2017 02:37
torch2424 pushed a commit to torch2424/amphtml that referenced this pull request Feb 14, 2017
* Render-start analytics event

* resolve cyclical dependency

* restrict render-start

* tests and docs

* working on docs

* DOMReady

* redo via signals

* tests

* Revert

* Changes to the docs

* tests

* lints
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
* Render-start analytics event

* resolve cyclical dependency

* restrict render-start

* tests and docs

* working on docs

* DOMReady

* redo via signals

* tests

* Revert

* Changes to the docs

* tests

* lints
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