Skip to content

Commit

Permalink
Use blink::Document::UkmRecorder in blink/renderer
Browse files Browse the repository at this point in the history
Document that within blink/renderer we can get a a UkmRecorder instance
by using blink::Document::UkmRecorder().

Change-Id: I6c06c87d4e0a2a4fba459ae57e75779a14a91277
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2634228
Reviewed-by: Robert Kaplow <[email protected]>
Commit-Queue: Wan-Teh Chang <[email protected]>
Cr-Commit-Position: refs/heads/master@{#844533}
  • Loading branch information
wantehchang authored and Chromium LUCI CQ committed Jan 18, 2021
1 parent a4daf96 commit b198de5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion services/metrics/ukm_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ emitted.

In order to record UKM events, your code needs a UkmRecorder object, defined by [//services/metrics/public/cpp/ukm_recorder.h](https://cs.chromium.org/chromium/src/services/metrics/public/cpp/ukm_recorder.h)

There are two main ways of getting a UkmRecorder instance.
There are three main ways of getting a UkmRecorder instance.

1) Use `ukm::UkmRecorder::Get()`. This currently only works from the Browser process.

Expand All @@ -180,6 +180,8 @@ ukm::builders::MyEvent(source_id)
.Record(ukm_recorder.get());
```
3) Within blink/renderer, use `blink::Document::UkmRecorder()`.
### Get A ukm::SourceId
UKM identifies navigations by their source ID and you'll need to associate an ID with your event in order to tie it to a main frame URL. Preferably, get an existing ID for the navigation from another object.
Expand Down

0 comments on commit b198de5

Please sign in to comment.