Skip to content

I2I: Error trigger in amp-analytics #6415

@lannka

Description

@lannka

This is for publisher to report client errors (maybe limited for user() error) to a specified analytics platform or their own server, so that they can get their problem noticed and fixed.

Google Webmaster can potentially be one of the pre-configured destinations.

Syntax
Pub configs custom event and error trigger just like other triggers:

<amp-analytics>
<script type="application/json">
{
  "requests": {
    "error": "https://example.com/report-error?name=${errorName}&message=${errorMessage}"
  },
  "triggers": {
    "Error" {
      "on": "error", // new proposed trigger type
      "request": "error",
    }
  }
}
</script>
</amp-analytics>

Example change in error logger
All client errors will be piped to specified destinations like this:

// in user() logger impl:
...
errorTrackersFor(doc).then(trackers => {
  trackers.forEach(tracker => {
     tracker.trackError(tag, message);
  });
});
...

@dvoytenko @avimehta @ericlindley-g @rudygalfi

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions