Skip to content

page click and page clickout events #20

@alexanderkirtzel

Description

@alexanderkirtzel

Is your feature request related to a problem? Please describe.
Besides the auto event page view I want the page click event that occurs when a user clicked on a page. If it's an external link I want it to be a page clickout event.

Describe the solution you'd like
There are three different options:

  1. Just a click somewhere on the page
  2. A click on an internal link
  3. A click on an external site

A page click event could contain the following basic data for all the options

interface PageClick {
  id: string,
  tagName: string,
  className: string
  isLink: boolean;
}

if isLink is true add these data properties

interface PageClickLink {
  title: string;
  text: string;
  href: string;
}

And if it's an external link change the action from click to clickout.

Describe alternatives you've considered
Don't measure it at all. This will lead to a lot of events. I guess people could be annoyed the amount of events and there should be a possibility to disable it (shout out to mapping).

Additional context
Inspiration from a previous beta:

function isLink(elem) {
  var parent = elem.parentElement;
  if (elem instanceof HTMLAnchorElement) return elem;
  return parent ? isLink(parent) : false;
}

function isExternalLink(elem) {
  return elem.host !== window.location.host;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions