Track when a Customer Logs in/Logs out

Topic summary

Goal: Reliably detect when a Shopify customer successfully logs in or logs out.

  • Context: The poster is building an extension app and needs a theme-agnostic solution.
  • Current finding: Shopify’s Web Pixels API, used for event tracking, does not appear to support login/logout events.
  • Attempted workaround: Added JavaScript to detect login form submissions and logout button clicks.
  • Limitation: This approach works in the poster’s theme but is not reliable across different themes because DOM element identifiers vary.
  • Status: No confirmed solution or API support mentioned; the question remains open.
  • Need: A robust, theme-independent method (or official API event) to accurately track successful login/logout actions.
  • Assets: No code snippets or media are central to understanding the issue.
Summarized with AI on December 26. AI used: gpt-5.

Is there any way to accurately track when a customer successfully logs in or logs out? I looked at web pixels API but that does not appear to be supporting this.

Next thing I tried was adding some script to determine when the login form was submitted or logout button was clicked. It appears to be working in my case but since I am trying to build an extension app, the identifier for the elements would differ based on the theme.