Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page click and page clickout events #20

Open
alexanderkirtzel opened this issue Mar 19, 2022 · 0 comments
Open

page click and page clickout events #20

alexanderkirtzel opened this issue Mar 19, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@alexanderkirtzel
Copy link
Collaborator

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;
}
@alexanderkirtzel alexanderkirtzel added the enhancement New feature or request label Mar 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant