Skip to content

Add convenience methods to track typical scenarios #156

@dheid

Description

@dheid

As a developer utilizing the Matomo Java Tracker in my application, I find it crucial to expand its capabilities by incorporating tracking methods that align with the existing PHP functionality. The focus is on introducing Java counterparts for the following tracking methods:

  • doTrackAction(actionUrl: string, actionType: string): mixed|string|true
  • doTrackContentImpression(contentName: string, [contentPiece: string = 'Unknown'], [contentTarget: bool|string = false]): mixed|string|true
  • doTrackContentInteraction(interaction: string, contentName: string, [contentPiece: string = 'Unknown'], [contentTarget: bool|string = false]): mixed|string|true
  • doTrackCrash(message: string, [type: null|string = null], [category: null|string = null], [stack: null|string = null], [location: null|string = null], [line: int|null = null], [column: int|null = null]): mixed|string|true
  • doTrackEcommerceCartUpdate(grandTotal: float): mixed|string|true
  • doTrackEcommerceOrder(orderId: int|string, grandTotal: float, [subTotal: float = 0.0], [tax: float = 0.0], [shipping: float = 0.0], [discount: float = 0.0]): mixed|string|true
  • doTrackEvent(category: string, action: string, [name: bool|string = false], [value: bool|float = false]): mixed|string|true
  • doTrackGoal(idGoal: int, [revenue: float = 0.0]): mixed|string|true
  • doTrackPageView(documentTitle: string): mixed|string|true
  • doTrackPhpThrowable(ex: Throwable, [category: null|string = null]): mixed|string|true
  • doTrackSiteSearch(keyword: string, [category: string = ''], [countResults: bool|int = false]): mixed|string|true

Usage

  • Developers, like myself, should be able to seamlessly incorporate these methods into their Java applications for tracking relevant events within the Matomo environment.

Implementation Guidelines

  • Ensure that the Java implementation mirrors the behavior of the corresponding PHP methods as documented in the MatomoTracker specifications.
  • Perform thorough validation of input parameters and handle exceptions gracefully.
  • Maintain compatibility with the existing Matomo Java Tracker structure and classes.

Testing

  • Rigorous unit tests should be conducted to validate the accuracy and reliability of the implemented tracking methods.
  • Integration tests can be performed in a controlled environment to verify the recorded data in the Matomo instance.

Documentation

  • Update the Matomo Java Tracker documentation to include detailed information about the newly added tracking methods.
  • Provide practical usage examples and any specific considerations for developers like myself.

Dependencies

  • No additional dependencies should be added.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions