<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSEvent/trackingNumber",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSEvent(py)trackingNumber"
  },
  "title" : "trackingNumber"
}
-->

# trackingNumber

The identifier of a mouse-tracking event.

```
var trackingNumber: Int { get }
```

## Discussion

This property contains either an [`NSTrackingArea`](/documentation/AppKit/NSTrackingArea) object or an [`NSView.TrackingRectTag`](/documentation/AppKit/NSView/TrackingRectTag) constant, depending on how AppKit generated the event. Valid mouse-tracking event types are [`NSMouseEntered`](/documentation/AppKit/NSMouseEntered), [`NSMouseExited`](/documentation/AppKit/NSMouseExited), and [`NSCursorUpdate`](/documentation/AppKit/NSCursorUpdate). For other types of events, accessing this property raises <doc://com.apple.documentation/documentation/Foundation/NSExceptionName/internalInconsistencyException>.

## See Also

[`+  enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:`](/documentation/AppKit/NSEvent/enterExitEvent(with:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:))

Creates and returns a new event object that describes a tracking-rectangle or cursor-update event.

[`-  addTrackingRect:owner:userData:assumeInside:`](/documentation/AppKit/NSView/addTrackingRect(_:owner:userData:assumeInside:))

Establishes an area for tracking mouse-entered and mouse-exited events within the view and returns a tag that identifies the tracking rectangle.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)