Skip to content

api.get.user_email does not work with non-workspace email addresses #786

Open
@DDorrance90

Description

@DDorrance90

As explained in this comment: #779 (comment)

It seems that the error occurs with personal accounts: @gmail.com, with professional accounts it works correctly.

To fix this error, add these instructions:

if(api.tracker.globals.length == 0 && GLOBALS !== "undefined" && GLOBALS.length > 11)
     api.tracker.globals = GLOBALS;

to the function: api.get.user_email

api.get.user_email = function() {
  if(api.tracker.globals.length == 0 && GLOBALS !== "undefined" && GLOBALS.length > 11)
    api.tracker.globals = GLOBALS;
		
  let user_email = api.tracker.globals[10];	  

  if (user_email) {
    return user_email;
  }
  const elements = document.getElementsByClassName("eYSAde");
  for (const el of elements) {
    if (el.innerHTML.indexOf("@") === -1) {
      return el.innerHTML;
    }
  }
      return null;
};

Location: api.get.user_email

There is a simple fix explained in the comment that worked for me. Just wanted to make a separate issue to make sure this doesn't fall through the cracks 😉

Problem

The api.get.user_email method always returns null

Testing Conditions

Problem can only be reproduced by using a gmail account ending in @gmail.com.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions