Class MatomoRequest

java.lang.Object
org.matomo.java.tracking.MatomoRequest

public class MatomoRequest extends Object
A class that implements the Matomo Tracking HTTP API. These requests can be sent using MatomoTracker.
Author:
brettcsorba
  • Constructor Details

    • MatomoRequest

      public MatomoRequest()
    • MatomoRequest

      public MatomoRequest(Boolean required, Integer siteId, String actionName, String actionUrl, String apiVersion, VisitorId visitorId, Boolean newVisitor, String referrerUrl, CustomVariables visitCustomVariables, Integer visitorVisitCount, Instant visitorPreviousVisitTimestamp, Instant visitorFirstVisitTimestamp, String campaignName, String campaignKeyword, DeviceResolution deviceResolution, Integer currentHour, Integer currentMinute, Integer currentSecond, Boolean pluginFlash, Boolean pluginJava, Boolean pluginDirector, Boolean pluginQuicktime, Boolean pluginRealPlayer, Boolean pluginPDF, Boolean pluginWindowsMedia, Boolean pluginGears, Boolean pluginSilverlight, Boolean supportsCookies, String headerUserAgent, String clientHints, AcceptLanguage headerAcceptLanguage, String userId, VisitorId visitorCustomId, Boolean newVisit, CustomVariables pageCustomVariables, String outlinkUrl, String downloadUrl, String searchQuery, String searchCategory, Long searchResultsCount, UniqueId pageViewId, Integer goalId, Double ecommerceRevenue, Charset characterSet, Boolean customAction, Long networkTime, Long serverTime, Long transferTime, Long domProcessingTime, Long domCompletionTime, Long onloadTime, String eventCategory, String eventAction, String eventName, Double eventValue, String contentName, String contentPiece, String contentTarget, String contentInteraction, String ecommerceId, EcommerceItems ecommerceItems, Double ecommerceSubtotal, Double ecommerceTax, Double ecommerceShippingCost, Double ecommerceDiscount, Instant ecommerceLastOrderTimestamp, String ecommerceProductSku, String ecommerceProductName, String ecommerceProductCategory, Double ecommerceProductPrice, String authToken, String visitorIp, Instant requestTimestamp, Country visitorCountry, String visitorRegion, String visitorCity, Double visitorLatitude, Double visitorLongitude, Boolean queuedTracking, Boolean responseAsImage, Boolean ping, Boolean trackBotRequests, Integer botRecordingMode, Integer httpStatusCode, Long bandwidthBytes, String sourceLabel, RandomValue randomValue, Boolean debug, String mediaId, String mediaTitle, String mediaResource, String mediaType, String mediaPlayerName, Integer mediaTimeSpent, Integer mediaLength, Integer mediaProgressPercent, Integer mediaTimeToPlay, Integer mediaWidth, Integer mediaHeight, Boolean mediaFullscreen, String mediaSegmentsViewed, String crashMessage, String crashType, String crashCategory, String crashStackTrace, String crashLocation, Integer crashLine, Integer crashColumn, String sessionId, Map<Long,Object> dimensions, Map<String,Object> additionalParameters, Map<String,String> headers, Map<String,String> cookies)
      Creates a new MatomoRequest instance.
      Parameters:
      required - The ID of the website we're tracking a visit/action for. Only needed, if no default site id is configured.
      siteId - The ID of the website we're tracking a visit/action for. Only needed, if no default site id is configured.
      actionName - The title of the action being tracked. For page tracks this is used as page title. If enabled in your installation you may use the category tree structure in this field. For example, "game / register new user" would then create a group "game" and add the item "register new user" in it.
      actionUrl - The full URL for the current action.
      apiVersion - Defines the API version to use (default: 1).
      visitorId - The unique visitor ID. See VisitorId. Default is VisitorId.random()

      Since version 3.0.0 this parameter is of type VisitorId and not a String anymore. Use VisitorId.fromHex(String) to create a VisitorId from a hex string, VisitorId.fromUUID(UUID) to create it from a UUID or VisitorId.fromHash(long) to create it from a long value.

      newVisitor - Tracks if the visitor is a returning visitor.

      This is done by storing a visitor ID in a 1st party cookie.

      referrerUrl - The full HTTP Referrer URL. This value is used to determine how someone got to your website (ie, through a website, search engine or campaign)
      visitCustomVariables - Custom variables are custom name-value pairs that you can assign to your visitors (or page views).
      visitorVisitCount - The current count of visits for this visitor. To set this value correctly, it would be required to store the value for each visitor in your application (using sessions or persisting in a database). Then you would manually increment the counts by one on each new visit or "session", depending on how you choose to define a visit.
      visitorPreviousVisitTimestamp - The UNIX timestamp of this visitor's previous visit. This parameter is used to populate the report Visitors > Engagement > Visits by days since last visit.
      visitorFirstVisitTimestamp - The UNIX timestamp of this visitor's first visit. This could be set to the date where the user first started using your software/app, or when he/she created an account.
      campaignName - The campaign name. This parameter will only be used for the first pageview of a visit.
      campaignKeyword - The campaign keyword (see Tracking Campaigns). Used to populate the Referrers > Campaigns report (clicking on a campaign loads all keywords for this campaign). This parameter will only be used for the first pageview of a visit.
      deviceResolution - The resolution of the device the visitor is using.
      currentHour - The current hour (local time).
      currentMinute - The current minute (local time).
      currentSecond - The current second (local time).
      pluginFlash - Does the visitor use the Adobe Flash Plugin.
      pluginJava - Does the visitor use the Java plugin.
      pluginDirector - Does the visitor use Director plugin.
      pluginQuicktime - Does the visitor use Quicktime plugin.
      pluginRealPlayer - Does the visitor use Realplayer plugin.
      pluginPDF - Does the visitor use a PDF plugin.
      pluginWindowsMedia - Does the visitor use a Windows Media plugin.
      pluginGears - Does the visitor use a Gears plugin.
      pluginSilverlight - Does the visitor use a Silverlight plugin.
      supportsCookies - Does the visitor's client is known to support cookies.
      headerUserAgent - An override value for the User-Agent HTTP header field.
      clientHints - JSON-encoded User Agent Client Hints collected by JavaScript. Used to enrich the detected user agent data.

      Example: {"brands":[{"brand":"Chromium","version":"110"}],"mobile":false}

      headerAcceptLanguage - An override value for the Accept-Language HTTP header field. This value is used to detect the visitor's country if GeoIP is not enabled.
      userId - Defines the User ID for this request. User ID is any non-empty unique string identifying the user (such as an email address or a username). When specified, the User ID will be "enforced". This means that if there is no recent visit with this User ID, a new one will be created. If a visit is found in the last 30 minutes with your specified User ID, then the new action will be recorded to this existing visit.
      visitorCustomId - defines the visitor ID for this request.
      newVisit - will force a new visit to be created for this action.
      pageCustomVariables - Custom variables are custom name-value pairs that you can assign to your visitors (or page views).
      outlinkUrl - An external URL the user has opened. Used for tracking outlink clicks. We recommend to also set the url parameter to this same value.
      downloadUrl - URL of a file the user has downloaded. Used for tracking downloads. We recommend to also set the url parameter to this same value.
      searchQuery - The Site Search keyword. When specified, the request will not be tracked as a normal pageview but will instead be tracked as a Site Search request
      searchCategory - When search is specified, you can optionally specify a search category with this parameter.
      searchResultsCount - When search is specified, we also recommend setting the search_count to the number of search results displayed on the results page. When keywords are tracked with &search_count=0 they will appear in the "No Result Search Keyword" report.
      pageViewId - Accepts a six character unique ID that identifies which actions were performed on a specific page view. When a page was viewed, all following tracking requests (such as events) during that page view should use the same pageview ID. Once another page was viewed a new unique ID should be generated. Use [0-9a-Z] as possible characters for the unique ID.
      goalId - If specified, the tracking request will trigger a conversion for the goal of the website being tracked with this ID. The value 0 tracks an ecommerce interaction.
      ecommerceRevenue - The grand total for the ecommerce order (required when tracking an ecommerce order).
      characterSet - The charset of the page being tracked. Specify the charset if the data you send to Matomo is encoded in a different character set than the default utf-8
      customAction - can be optionally sent along any tracking request that isn't a page view. For example, it can be sent together with an event tracking request. The advantage being that should you ever disable the event plugin, then the event tracking requests will be ignored vs if the parameter is not set, a page view would be tracked even though it isn't a page view.
      networkTime - How long it took to connect to server.
      serverTime - How long it took the server to generate page.
      transferTime - How long it takes the browser to download the response from the server.
      domProcessingTime - How long the browser spends loading the webpage after the response was fully received until the user can start interacting with it.
      domCompletionTime - How long it takes for the browser to load media and execute any Javascript code listening for the DOMContentLoaded event.
      onloadTime - How long it takes the browser to execute Javascript code waiting for the window.load event.
      eventCategory - eg. Videos, Music, Games...
      eventAction - An event action like Play, Pause, Duration, Add Playlist, Downloaded, Clicked...
      eventName - The event name for example a Movie name, or Song name, or File name...
      eventValue - Some numeric value that represents the event value.
      contentName - The name of the content. For instance 'Ad Foo Bar'
      contentPiece - The actual content piece. For instance the path to an image, video, audio, any text
      contentTarget - The target of the content. For instance the URL of a landing page
      contentInteraction - The name of the interaction with the content. For instance a 'click'
      ecommerceId - The unique string identifier for the ecommerce order (required when tracking an ecommerce order).
      ecommerceItems - Items in the Ecommerce order.
      ecommerceSubtotal - The subtotal of the order; excludes shipping.
      ecommerceTax - Tax amount of the order.
      ecommerceShippingCost - Shipping cost of the order.
      ecommerceDiscount - Discount offered.
      ecommerceLastOrderTimestamp - The UNIX timestamp of this customer's last ecommerce order. This value is used to process the "Days since last order" report.
      ecommerceProductSku - The SKU of the product being viewed. Used for ecommerce product page tracking.

      Requires idgoal=0 and _pks to be set.

      ecommerceProductName - The name of the product being viewed. Used for ecommerce product page tracking.

      Requires idgoal=0 and _pks to be set.

      ecommerceProductCategory - The category of the product being viewed. Used for ecommerce product page tracking.

      Can be a string or a JSON-encoded array of up to five category names.

      Requires idgoal=0 and _pks to be set.

      ecommerceProductPrice - The price of the product being viewed. Used for ecommerce product page tracking.

      Requires idgoal=0 and _pks to be set.

      authToken - 32 character authorization key used to authenticate the API request. We recommend to create a user specifically for accessing the Tracking API, and give the user only write permission on the website(s).
      visitorIp - Override value for the visitor IP (both IPv4 and IPv6 notations supported).
      requestTimestamp - Override for the datetime of the request (normally the current time is used). This can be used to record visits and page views in the past.
      visitorCountry - An override value for the country. Must be a two-letter ISO 3166 Alpha-2 country code.
      visitorRegion - An override value for the region. Should be set to a ISO 3166-2 region code, which are used by MaxMind's and DB-IP's GeoIP2 databases. See here for a list of them for every country.
      visitorCity - An override value for the city. The name of the city the visitor is located in, eg, Tokyo.
      visitorLatitude - An override value for the visitor's latitude, eg 22.456.
      visitorLongitude - An override value for the visitor's longitude, eg 22.456.
      queuedTracking - When set to false, the queued tracking handler won't be used and instead the tracking request will be executed directly. This can be useful when you need to debug a tracking problem or want to test that the tracking works in general.
      responseAsImage - If set to 0 (send_image=0) Matomo will respond with an HTTP 204 response code instead of a GIF image. This improves performance and can fix errors if images are not allowed to be obtained directly (like Chrome Apps). Available since Matomo 2.10.0

      Default is false

      ping - If set to true, the request will be a Heartbeat request which will not track any new activity (such as a new visit, new action or new goal). The heartbeat request will only update the visit's total time to provide accurate "Visit duration" metric when this parameter is set. It won't record any other data. This means by sending an additional tracking request when the user leaves your site or app with &ping=1, you fix the issue where the time spent of the last page visited is reported as 0 seconds.
      trackBotRequests - By default, Matomo does not track bots. If you use the Tracking HTTP API directly, you may be interested in tracking bot requests.
      botRecordingMode - When bots=1 is set, this specifies the recording mode for bot requests.

      Set to 1 to record bot requests without triggering any goals, events or actions.

      httpStatusCode - The HTTP status code of the tracked request. Used with bot tracking.

      When tracking a bot visit, this can be set to the HTTP status code of the bot's request.

      bandwidthBytes - The bandwidth used for the tracked request in bytes. Used with bot tracking.
      sourceLabel - Defines the source of the tracking request (e.g., "backend" or "mobile-app").

      Used to classify where the tracking hit originated.

      randomValue - Meant to hold a random value that is generated before each request. Using it helps avoid the tracking request being cached by the browser or a proxy.
      debug - Meant to hold a random value that is generated before each request. Using it helps avoid the tracking request being cached by the browser or a proxy.
      mediaId - A unique ID used to identify the media. Part of the Media Analytics plugin.
      mediaTitle - The title of the media resource. Part of the Media Analytics plugin.
      mediaResource - The URL of the media resource. Part of the Media Analytics plugin.
      mediaType - The type of media, e.g. "video" or "audio". Part of the Media Analytics plugin.
      mediaPlayerName - The name of the media player used to play the media, e.g. "html5". Part of the Media Analytics plugin.
      mediaTimeSpent - The number of seconds the visitor has spent playing/watching the media resource so far. Part of the Media Analytics plugin.
      mediaLength - The total duration / length of the media resource in seconds. Part of the Media Analytics plugin.
      mediaProgressPercent - The current progress of the media in percent (0–100). Part of the Media Analytics plugin.
      mediaTimeToPlay - How many seconds it took before the media started playing. Part of the Media Analytics plugin.
      mediaWidth - The width of the media player in pixels. Part of the Media Analytics plugin.
      mediaHeight - The height of the media player in pixels. Part of the Media Analytics plugin.
      mediaFullscreen - Whether the media is currently displayed in fullscreen. Part of the Media Analytics plugin.
      mediaSegmentsViewed - A JSON-encoded array of which positions in the media were viewed by the visitor. Part of the Media Analytics plugin.

      Example: [[0,15],[30,44]] means the visitor watched segments 0–15s and 30–44s.

      crashMessage - Contains an error message describing the error that occurred during the last tracking request.

      Custom action must be enabled for this.

      Required for crash analytics

      crashType - The type of exception that occurred during the last tracking request.

      Custom action must be enabled for this.

      Typically a fully qualified class name of the exception, e.g. java.lang.NullPointerException.

      Optional for crash analytics

      crashCategory - Category of a crash to group crashes by.

      Custom action must be enabled for this.

      Optional for crash analytics

      crashStackTrace - A stack trace of the exception that occurred during the last tracking request.

      Custom action must be enabled for this.

      Optional for crash analytics

      crashLocation - The originating source of the crash.

      Could be a source file URI or something similar

      Custom action must be enabled for this.

      Optional for crash analytics

      crashLine - The line number of the crash source, where the crash occurred.

      Custom action must be enabled for this.

      Optional for crash analytics

      crashColumn - The column within the line where the crash occurred.

      Optional for crash analytics

      sessionId - The Matomo session ID sent as a cookie MATOMO_SESSID.

      If not null a cookie with the name MATOMO_SESSID will be sent with the value of this parameter.

      dimensions - Custom Dimension values for specific Custom Dimension IDs.

      Custom Dimensions plugin must be installed. See the Custom Dimensions guide. Requires Matomo at least 2.15.1

      additionalParameters - Allows you to specify additional HTTP request parameters that will be sent to Matomo.

      For example, you can use this to set the Accept-Language header, or to set the Content-Type.

      headers - You can set additional HTTP headers for the request sent to Matomo.

      For example, you can use this to set the Accept-Language header, or to set the Content-Type.

      cookies - Appends additional cookies to the request.

      This allows you to add Matomo specific cookies, like _pk_id or _pk_sess coming from Matomo responses to the request.

  • Method Details

    • request

      public static MatomoRequest.MatomoRequestBuilder request()
    • getRequired

      public Boolean getRequired()
      The ID of the website we're tracking a visit/action for. Only needed, if no default site id is configured.
    • getSiteId

      public Integer getSiteId()
      The ID of the website we're tracking a visit/action for. Only needed, if no default site id is configured.
    • getActionName

      public String getActionName()
      The title of the action being tracked. For page tracks this is used as page title. If enabled in your installation you may use the category tree structure in this field. For example, "game / register new user" would then create a group "game" and add the item "register new user" in it.
    • getActionUrl

      public String getActionUrl()
      The full URL for the current action.
    • getApiVersion

      public String getApiVersion()
      Defines the API version to use (default: 1).
    • getVisitorId

      public VisitorId getVisitorId()
      The unique visitor ID. See VisitorId. Default is VisitorId.random()

      Since version 3.0.0 this parameter is of type VisitorId and not a String anymore. Use VisitorId.fromHex(String) to create a VisitorId from a hex string, VisitorId.fromUUID(UUID) to create it from a UUID or VisitorId.fromHash(long) to create it from a long value.

    • getNewVisitor

      public Boolean getNewVisitor()
      Tracks if the visitor is a returning visitor.

      This is done by storing a visitor ID in a 1st party cookie.

    • getReferrerUrl

      public String getReferrerUrl()
      The full HTTP Referrer URL. This value is used to determine how someone got to your website (ie, through a website, search engine or campaign)
    • getVisitCustomVariables

      public CustomVariables getVisitCustomVariables()
      Custom variables are custom name-value pairs that you can assign to your visitors (or page views).
    • getVisitorVisitCount

      public Integer getVisitorVisitCount()
      The current count of visits for this visitor. To set this value correctly, it would be required to store the value for each visitor in your application (using sessions or persisting in a database). Then you would manually increment the counts by one on each new visit or "session", depending on how you choose to define a visit.
    • getVisitorPreviousVisitTimestamp

      public Instant getVisitorPreviousVisitTimestamp()
      The UNIX timestamp of this visitor's previous visit. This parameter is used to populate the report Visitors > Engagement > Visits by days since last visit.
    • getVisitorFirstVisitTimestamp

      public Instant getVisitorFirstVisitTimestamp()
      The UNIX timestamp of this visitor's first visit. This could be set to the date where the user first started using your software/app, or when he/she created an account.
    • getCampaignName

      public String getCampaignName()
      The campaign name. This parameter will only be used for the first pageview of a visit.
    • getCampaignKeyword

      public String getCampaignKeyword()
      The campaign keyword (see Tracking Campaigns). Used to populate the Referrers > Campaigns report (clicking on a campaign loads all keywords for this campaign). This parameter will only be used for the first pageview of a visit.
    • getDeviceResolution

      public DeviceResolution getDeviceResolution()
      The resolution of the device the visitor is using.
    • getCurrentHour

      public Integer getCurrentHour()
      The current hour (local time).
    • getCurrentMinute

      public Integer getCurrentMinute()
      The current minute (local time).
    • getCurrentSecond

      public Integer getCurrentSecond()
      The current second (local time).
    • getPluginFlash

      public Boolean getPluginFlash()
      Does the visitor use the Adobe Flash Plugin.
    • getPluginJava

      public Boolean getPluginJava()
      Does the visitor use the Java plugin.
    • getPluginDirector

      public Boolean getPluginDirector()
      Does the visitor use Director plugin.
    • getPluginQuicktime

      public Boolean getPluginQuicktime()
      Does the visitor use Quicktime plugin.
    • getPluginRealPlayer

      public Boolean getPluginRealPlayer()
      Does the visitor use Realplayer plugin.
    • getPluginPDF

      public Boolean getPluginPDF()
      Does the visitor use a PDF plugin.
    • getPluginWindowsMedia

      public Boolean getPluginWindowsMedia()
      Does the visitor use a Windows Media plugin.
    • getPluginGears

      public Boolean getPluginGears()
      Does the visitor use a Gears plugin.
    • getPluginSilverlight

      public Boolean getPluginSilverlight()
      Does the visitor use a Silverlight plugin.
    • getSupportsCookies

      public Boolean getSupportsCookies()
      Does the visitor's client is known to support cookies.
    • getHeaderUserAgent

      public String getHeaderUserAgent()
      An override value for the User-Agent HTTP header field.
    • getClientHints

      public String getClientHints()
      JSON-encoded User Agent Client Hints collected by JavaScript. Used to enrich the detected user agent data.

      Example: {"brands":[{"brand":"Chromium","version":"110"}],"mobile":false}

    • getHeaderAcceptLanguage

      public AcceptLanguage getHeaderAcceptLanguage()
      An override value for the Accept-Language HTTP header field. This value is used to detect the visitor's country if GeoIP is not enabled.
    • getUserId

      public String getUserId()
      Defines the User ID for this request. User ID is any non-empty unique string identifying the user (such as an email address or a username). When specified, the User ID will be "enforced". This means that if there is no recent visit with this User ID, a new one will be created. If a visit is found in the last 30 minutes with your specified User ID, then the new action will be recorded to this existing visit.
    • getVisitorCustomId

      public VisitorId getVisitorCustomId()
      defines the visitor ID for this request.
    • getNewVisit

      public Boolean getNewVisit()
      will force a new visit to be created for this action.
    • getPageCustomVariables

      public CustomVariables getPageCustomVariables()
      Custom variables are custom name-value pairs that you can assign to your visitors (or page views).
    • getOutlinkUrl

      public String getOutlinkUrl()
      An external URL the user has opened. Used for tracking outlink clicks. We recommend to also set the url parameter to this same value.
    • getDownloadUrl

      public String getDownloadUrl()
      URL of a file the user has downloaded. Used for tracking downloads. We recommend to also set the url parameter to this same value.
    • getSearchQuery

      public String getSearchQuery()
      The Site Search keyword. When specified, the request will not be tracked as a normal pageview but will instead be tracked as a Site Search request
    • getSearchCategory

      public String getSearchCategory()
      When search is specified, you can optionally specify a search category with this parameter.
    • getSearchResultsCount

      public Long getSearchResultsCount()
      When search is specified, we also recommend setting the search_count to the number of search results displayed on the results page. When keywords are tracked with &search_count=0 they will appear in the "No Result Search Keyword" report.
    • getPageViewId

      public UniqueId getPageViewId()
      Accepts a six character unique ID that identifies which actions were performed on a specific page view. When a page was viewed, all following tracking requests (such as events) during that page view should use the same pageview ID. Once another page was viewed a new unique ID should be generated. Use [0-9a-Z] as possible characters for the unique ID.
    • getGoalId

      public Integer getGoalId()
      If specified, the tracking request will trigger a conversion for the goal of the website being tracked with this ID. The value 0 tracks an ecommerce interaction.
    • getEcommerceRevenue

      public Double getEcommerceRevenue()
      The grand total for the ecommerce order (required when tracking an ecommerce order).
    • getCharacterSet

      public Charset getCharacterSet()
      The charset of the page being tracked. Specify the charset if the data you send to Matomo is encoded in a different character set than the default utf-8
    • getCustomAction

      public Boolean getCustomAction()
      can be optionally sent along any tracking request that isn't a page view. For example, it can be sent together with an event tracking request. The advantage being that should you ever disable the event plugin, then the event tracking requests will be ignored vs if the parameter is not set, a page view would be tracked even though it isn't a page view.
    • getNetworkTime

      public Long getNetworkTime()
      How long it took to connect to server.
    • getServerTime

      public Long getServerTime()
      How long it took the server to generate page.
    • getTransferTime

      public Long getTransferTime()
      How long it takes the browser to download the response from the server.
    • getDomProcessingTime

      public Long getDomProcessingTime()
      How long the browser spends loading the webpage after the response was fully received until the user can start interacting with it.
    • getDomCompletionTime

      public Long getDomCompletionTime()
      How long it takes for the browser to load media and execute any Javascript code listening for the DOMContentLoaded event.
    • getOnloadTime

      public Long getOnloadTime()
      How long it takes the browser to execute Javascript code waiting for the window.load event.
    • getEventCategory

      public String getEventCategory()
      eg. Videos, Music, Games...
    • getEventAction

      public String getEventAction()
      An event action like Play, Pause, Duration, Add Playlist, Downloaded, Clicked...
    • getEventName

      public String getEventName()
      The event name for example a Movie name, or Song name, or File name...
    • getEventValue

      public Double getEventValue()
      Some numeric value that represents the event value.
    • getContentName

      public String getContentName()
      The name of the content. For instance 'Ad Foo Bar'
    • getContentPiece

      public String getContentPiece()
      The actual content piece. For instance the path to an image, video, audio, any text
    • getContentTarget

      public String getContentTarget()
      The target of the content. For instance the URL of a landing page
    • getContentInteraction

      public String getContentInteraction()
      The name of the interaction with the content. For instance a 'click'
    • getEcommerceId

      public String getEcommerceId()
      The unique string identifier for the ecommerce order (required when tracking an ecommerce order).
    • getEcommerceItems

      public EcommerceItems getEcommerceItems()
      Items in the Ecommerce order.
    • getEcommerceSubtotal

      public Double getEcommerceSubtotal()
      The subtotal of the order; excludes shipping.
    • getEcommerceTax

      public Double getEcommerceTax()
      Tax amount of the order.
    • getEcommerceShippingCost

      public Double getEcommerceShippingCost()
      Shipping cost of the order.
    • getEcommerceDiscount

      public Double getEcommerceDiscount()
      Discount offered.
    • getEcommerceLastOrderTimestamp

      public Instant getEcommerceLastOrderTimestamp()
      The UNIX timestamp of this customer's last ecommerce order. This value is used to process the "Days since last order" report.
    • getEcommerceProductSku

      public String getEcommerceProductSku()
      The SKU of the product being viewed. Used for ecommerce product page tracking.

      Requires idgoal=0 and _pks to be set.

    • getEcommerceProductName

      public String getEcommerceProductName()
      The name of the product being viewed. Used for ecommerce product page tracking.

      Requires idgoal=0 and _pks to be set.

    • getEcommerceProductCategory

      public String getEcommerceProductCategory()
      The category of the product being viewed. Used for ecommerce product page tracking.

      Can be a string or a JSON-encoded array of up to five category names.

      Requires idgoal=0 and _pks to be set.

    • getEcommerceProductPrice

      public Double getEcommerceProductPrice()
      The price of the product being viewed. Used for ecommerce product page tracking.

      Requires idgoal=0 and _pks to be set.

    • getAuthToken

      public String getAuthToken()
      32 character authorization key used to authenticate the API request. We recommend to create a user specifically for accessing the Tracking API, and give the user only write permission on the website(s).
    • getVisitorIp

      public String getVisitorIp()
      Override value for the visitor IP (both IPv4 and IPv6 notations supported).
    • getRequestTimestamp

      public Instant getRequestTimestamp()
      Override for the datetime of the request (normally the current time is used). This can be used to record visits and page views in the past.
    • getVisitorCountry

      public Country getVisitorCountry()
      An override value for the country. Must be a two-letter ISO 3166 Alpha-2 country code.
    • getVisitorRegion

      public String getVisitorRegion()
      An override value for the region. Should be set to a ISO 3166-2 region code, which are used by MaxMind's and DB-IP's GeoIP2 databases. See here for a list of them for every country.
    • getVisitorCity

      public String getVisitorCity()
      An override value for the city. The name of the city the visitor is located in, eg, Tokyo.
    • getVisitorLatitude

      public Double getVisitorLatitude()
      An override value for the visitor's latitude, eg 22.456.
    • getVisitorLongitude

      public Double getVisitorLongitude()
      An override value for the visitor's longitude, eg 22.456.
    • getQueuedTracking

      public Boolean getQueuedTracking()
      When set to false, the queued tracking handler won't be used and instead the tracking request will be executed directly. This can be useful when you need to debug a tracking problem or want to test that the tracking works in general.
    • getResponseAsImage

      public Boolean getResponseAsImage()
      If set to 0 (send_image=0) Matomo will respond with an HTTP 204 response code instead of a GIF image. This improves performance and can fix errors if images are not allowed to be obtained directly (like Chrome Apps). Available since Matomo 2.10.0

      Default is false

    • getPing

      public Boolean getPing()
      If set to true, the request will be a Heartbeat request which will not track any new activity (such as a new visit, new action or new goal). The heartbeat request will only update the visit's total time to provide accurate "Visit duration" metric when this parameter is set. It won't record any other data. This means by sending an additional tracking request when the user leaves your site or app with &ping=1, you fix the issue where the time spent of the last page visited is reported as 0 seconds.
    • getTrackBotRequests

      public Boolean getTrackBotRequests()
      By default, Matomo does not track bots. If you use the Tracking HTTP API directly, you may be interested in tracking bot requests.
    • getBotRecordingMode

      public Integer getBotRecordingMode()
      When bots=1 is set, this specifies the recording mode for bot requests.

      Set to 1 to record bot requests without triggering any goals, events or actions.

    • getHttpStatusCode

      public Integer getHttpStatusCode()
      The HTTP status code of the tracked request. Used with bot tracking.

      When tracking a bot visit, this can be set to the HTTP status code of the bot's request.

    • getBandwidthBytes

      public Long getBandwidthBytes()
      The bandwidth used for the tracked request in bytes. Used with bot tracking.
    • getSourceLabel

      public String getSourceLabel()
      Defines the source of the tracking request (e.g., "backend" or "mobile-app").

      Used to classify where the tracking hit originated.

    • getRandomValue

      public RandomValue getRandomValue()
      Meant to hold a random value that is generated before each request. Using it helps avoid the tracking request being cached by the browser or a proxy.
    • getDebug

      public Boolean getDebug()
      Meant to hold a random value that is generated before each request. Using it helps avoid the tracking request being cached by the browser or a proxy.
    • getMediaId

      public String getMediaId()
      A unique ID used to identify the media. Part of the Media Analytics plugin.
    • getMediaTitle

      public String getMediaTitle()
      The title of the media resource. Part of the Media Analytics plugin.
    • getMediaResource

      public String getMediaResource()
      The URL of the media resource. Part of the Media Analytics plugin.
    • getMediaType

      public String getMediaType()
      The type of media, e.g. "video" or "audio". Part of the Media Analytics plugin.
    • getMediaPlayerName

      public String getMediaPlayerName()
      The name of the media player used to play the media, e.g. "html5". Part of the Media Analytics plugin.
    • getMediaTimeSpent

      public Integer getMediaTimeSpent()
      The number of seconds the visitor has spent playing/watching the media resource so far. Part of the Media Analytics plugin.
    • getMediaLength

      public Integer getMediaLength()
      The total duration / length of the media resource in seconds. Part of the Media Analytics plugin.
    • getMediaProgressPercent

      public Integer getMediaProgressPercent()
      The current progress of the media in percent (0–100). Part of the Media Analytics plugin.
    • getMediaTimeToPlay

      public Integer getMediaTimeToPlay()
      How many seconds it took before the media started playing. Part of the Media Analytics plugin.
    • getMediaWidth

      public Integer getMediaWidth()
      The width of the media player in pixels. Part of the Media Analytics plugin.
    • getMediaHeight

      public Integer getMediaHeight()
      The height of the media player in pixels. Part of the Media Analytics plugin.
    • getMediaFullscreen

      public Boolean getMediaFullscreen()
      Whether the media is currently displayed in fullscreen. Part of the Media Analytics plugin.
    • getMediaSegmentsViewed

      public String getMediaSegmentsViewed()
      A JSON-encoded array of which positions in the media were viewed by the visitor. Part of the Media Analytics plugin.

      Example: [[0,15],[30,44]] means the visitor watched segments 0–15s and 30–44s.

    • getCrashMessage

      public String getCrashMessage()
      Contains an error message describing the error that occurred during the last tracking request.

      Custom action must be enabled for this.

      Required for crash analytics

    • getCrashType

      public String getCrashType()
      The type of exception that occurred during the last tracking request.

      Custom action must be enabled for this.

      Typically a fully qualified class name of the exception, e.g. java.lang.NullPointerException.

      Optional for crash analytics

    • getCrashCategory

      public String getCrashCategory()
      Category of a crash to group crashes by.

      Custom action must be enabled for this.

      Optional for crash analytics

    • getCrashStackTrace

      public String getCrashStackTrace()
      A stack trace of the exception that occurred during the last tracking request.

      Custom action must be enabled for this.

      Optional for crash analytics

    • getCrashLocation

      public String getCrashLocation()
      The originating source of the crash.

      Could be a source file URI or something similar

      Custom action must be enabled for this.

      Optional for crash analytics

    • getCrashLine

      public Integer getCrashLine()
      The line number of the crash source, where the crash occurred.

      Custom action must be enabled for this.

      Optional for crash analytics

    • getCrashColumn

      public Integer getCrashColumn()
      The column within the line where the crash occurred.

      Optional for crash analytics

    • getSessionId

      public String getSessionId()
      The Matomo session ID sent as a cookie MATOMO_SESSID.

      If not null a cookie with the name MATOMO_SESSID will be sent with the value of this parameter.

    • getDimensions

      public Map<Long,Object> getDimensions()
      Custom Dimension values for specific Custom Dimension IDs.

      Custom Dimensions plugin must be installed. See the Custom Dimensions guide. Requires Matomo at least 2.15.1

    • getAdditionalParameters

      public Map<String,Object> getAdditionalParameters()
      Allows you to specify additional HTTP request parameters that will be sent to Matomo.

      For example, you can use this to set the Accept-Language header, or to set the Content-Type.

    • getHeaders

      public Map<String,String> getHeaders()
      You can set additional HTTP headers for the request sent to Matomo.

      For example, you can use this to set the Accept-Language header, or to set the Content-Type.

    • getCookies

      public Map<String,String> getCookies()
      Appends additional cookies to the request.

      This allows you to add Matomo specific cookies, like _pk_id or _pk_sess coming from Matomo responses to the request.

    • setRequired

      public void setRequired(Boolean required)
      The ID of the website we're tracking a visit/action for. Only needed, if no default site id is configured.
    • setSiteId

      public void setSiteId(Integer siteId)
      The ID of the website we're tracking a visit/action for. Only needed, if no default site id is configured.
    • setActionName

      public void setActionName(String actionName)
      The title of the action being tracked. For page tracks this is used as page title. If enabled in your installation you may use the category tree structure in this field. For example, "game / register new user" would then create a group "game" and add the item "register new user" in it.
    • setActionUrl

      public void setActionUrl(String actionUrl)
      The full URL for the current action.
    • setApiVersion

      public void setApiVersion(String apiVersion)
      Defines the API version to use (default: 1).
    • setVisitorId

      public void setVisitorId(VisitorId visitorId)
      The unique visitor ID. See VisitorId. Default is VisitorId.random()

      Since version 3.0.0 this parameter is of type VisitorId and not a String anymore. Use VisitorId.fromHex(String) to create a VisitorId from a hex string, VisitorId.fromUUID(UUID) to create it from a UUID or VisitorId.fromHash(long) to create it from a long value.

    • setNewVisitor

      public void setNewVisitor(Boolean newVisitor)
      Tracks if the visitor is a returning visitor.

      This is done by storing a visitor ID in a 1st party cookie.

    • setReferrerUrl

      public void setReferrerUrl(String referrerUrl)
      The full HTTP Referrer URL. This value is used to determine how someone got to your website (ie, through a website, search engine or campaign)
    • setVisitCustomVariables

      public void setVisitCustomVariables(CustomVariables visitCustomVariables)
      Custom variables are custom name-value pairs that you can assign to your visitors (or page views).
    • setVisitorVisitCount

      public void setVisitorVisitCount(Integer visitorVisitCount)
      The current count of visits for this visitor. To set this value correctly, it would be required to store the value for each visitor in your application (using sessions or persisting in a database). Then you would manually increment the counts by one on each new visit or "session", depending on how you choose to define a visit.
    • setVisitorPreviousVisitTimestamp

      public void setVisitorPreviousVisitTimestamp(Instant visitorPreviousVisitTimestamp)
      The UNIX timestamp of this visitor's previous visit. This parameter is used to populate the report Visitors > Engagement > Visits by days since last visit.
    • setVisitorFirstVisitTimestamp

      public void setVisitorFirstVisitTimestamp(Instant visitorFirstVisitTimestamp)
      The UNIX timestamp of this visitor's first visit. This could be set to the date where the user first started using your software/app, or when he/she created an account.
    • setCampaignName

      public void setCampaignName(String campaignName)
      The campaign name. This parameter will only be used for the first pageview of a visit.
    • setCampaignKeyword

      public void setCampaignKeyword(String campaignKeyword)
      The campaign keyword (see Tracking Campaigns). Used to populate the Referrers > Campaigns report (clicking on a campaign loads all keywords for this campaign). This parameter will only be used for the first pageview of a visit.
    • setDeviceResolution

      public void setDeviceResolution(DeviceResolution deviceResolution)
      The resolution of the device the visitor is using.
    • setCurrentHour

      public void setCurrentHour(Integer currentHour)
      The current hour (local time).
    • setCurrentMinute

      public void setCurrentMinute(Integer currentMinute)
      The current minute (local time).
    • setCurrentSecond

      public void setCurrentSecond(Integer currentSecond)
      The current second (local time).
    • setPluginFlash

      public void setPluginFlash(Boolean pluginFlash)
      Does the visitor use the Adobe Flash Plugin.
    • setPluginJava

      public void setPluginJava(Boolean pluginJava)
      Does the visitor use the Java plugin.
    • setPluginDirector

      public void setPluginDirector(Boolean pluginDirector)
      Does the visitor use Director plugin.
    • setPluginQuicktime

      public void setPluginQuicktime(Boolean pluginQuicktime)
      Does the visitor use Quicktime plugin.
    • setPluginRealPlayer

      public void setPluginRealPlayer(Boolean pluginRealPlayer)
      Does the visitor use Realplayer plugin.
    • setPluginPDF

      public void setPluginPDF(Boolean pluginPDF)
      Does the visitor use a PDF plugin.
    • setPluginWindowsMedia

      public void setPluginWindowsMedia(Boolean pluginWindowsMedia)
      Does the visitor use a Windows Media plugin.
    • setPluginGears

      public void setPluginGears(Boolean pluginGears)
      Does the visitor use a Gears plugin.
    • setPluginSilverlight

      public void setPluginSilverlight(Boolean pluginSilverlight)
      Does the visitor use a Silverlight plugin.
    • setSupportsCookies

      public void setSupportsCookies(Boolean supportsCookies)
      Does the visitor's client is known to support cookies.
    • setHeaderUserAgent

      public void setHeaderUserAgent(String headerUserAgent)
      An override value for the User-Agent HTTP header field.
    • setClientHints

      public void setClientHints(String clientHints)
      JSON-encoded User Agent Client Hints collected by JavaScript. Used to enrich the detected user agent data.

      Example: {"brands":[{"brand":"Chromium","version":"110"}],"mobile":false}

    • setHeaderAcceptLanguage

      public void setHeaderAcceptLanguage(AcceptLanguage headerAcceptLanguage)
      An override value for the Accept-Language HTTP header field. This value is used to detect the visitor's country if GeoIP is not enabled.
    • setUserId

      public void setUserId(String userId)
      Defines the User ID for this request. User ID is any non-empty unique string identifying the user (such as an email address or a username). When specified, the User ID will be "enforced". This means that if there is no recent visit with this User ID, a new one will be created. If a visit is found in the last 30 minutes with your specified User ID, then the new action will be recorded to this existing visit.
    • setVisitorCustomId

      public void setVisitorCustomId(VisitorId visitorCustomId)
      defines the visitor ID for this request.
    • setNewVisit

      public void setNewVisit(Boolean newVisit)
      will force a new visit to be created for this action.
    • setPageCustomVariables

      public void setPageCustomVariables(CustomVariables pageCustomVariables)
      Custom variables are custom name-value pairs that you can assign to your visitors (or page views).
    • setOutlinkUrl

      public void setOutlinkUrl(String outlinkUrl)
      An external URL the user has opened. Used for tracking outlink clicks. We recommend to also set the url parameter to this same value.
    • setDownloadUrl

      public void setDownloadUrl(String downloadUrl)
      URL of a file the user has downloaded. Used for tracking downloads. We recommend to also set the url parameter to this same value.
    • setSearchQuery

      public void setSearchQuery(String searchQuery)
      The Site Search keyword. When specified, the request will not be tracked as a normal pageview but will instead be tracked as a Site Search request
    • setSearchCategory

      public void setSearchCategory(String searchCategory)
      When search is specified, you can optionally specify a search category with this parameter.
    • setSearchResultsCount

      public void setSearchResultsCount(Long searchResultsCount)
      When search is specified, we also recommend setting the search_count to the number of search results displayed on the results page. When keywords are tracked with &search_count=0 they will appear in the "No Result Search Keyword" report.
    • setPageViewId

      public void setPageViewId(UniqueId pageViewId)
      Accepts a six character unique ID that identifies which actions were performed on a specific page view. When a page was viewed, all following tracking requests (such as events) during that page view should use the same pageview ID. Once another page was viewed a new unique ID should be generated. Use [0-9a-Z] as possible characters for the unique ID.
    • setGoalId

      public void setGoalId(Integer goalId)
      If specified, the tracking request will trigger a conversion for the goal of the website being tracked with this ID. The value 0 tracks an ecommerce interaction.
    • setEcommerceRevenue

      public void setEcommerceRevenue(Double ecommerceRevenue)
      The grand total for the ecommerce order (required when tracking an ecommerce order).
    • setCharacterSet

      public void setCharacterSet(Charset characterSet)
      The charset of the page being tracked. Specify the charset if the data you send to Matomo is encoded in a different character set than the default utf-8
    • setCustomAction

      public void setCustomAction(Boolean customAction)
      can be optionally sent along any tracking request that isn't a page view. For example, it can be sent together with an event tracking request. The advantage being that should you ever disable the event plugin, then the event tracking requests will be ignored vs if the parameter is not set, a page view would be tracked even though it isn't a page view.
    • setNetworkTime

      public void setNetworkTime(Long networkTime)
      How long it took to connect to server.
    • setServerTime

      public void setServerTime(Long serverTime)
      How long it took the server to generate page.
    • setTransferTime

      public void setTransferTime(Long transferTime)
      How long it takes the browser to download the response from the server.
    • setDomProcessingTime

      public void setDomProcessingTime(Long domProcessingTime)
      How long the browser spends loading the webpage after the response was fully received until the user can start interacting with it.
    • setDomCompletionTime

      public void setDomCompletionTime(Long domCompletionTime)
      How long it takes for the browser to load media and execute any Javascript code listening for the DOMContentLoaded event.
    • setOnloadTime

      public void setOnloadTime(Long onloadTime)
      How long it takes the browser to execute Javascript code waiting for the window.load event.
    • setEventCategory

      public void setEventCategory(String eventCategory)
      eg. Videos, Music, Games...
    • setEventAction

      public void setEventAction(String eventAction)
      An event action like Play, Pause, Duration, Add Playlist, Downloaded, Clicked...
    • setEventName

      public void setEventName(String eventName)
      The event name for example a Movie name, or Song name, or File name...
    • setEventValue

      public void setEventValue(Double eventValue)
      Some numeric value that represents the event value.
    • setContentName

      public void setContentName(String contentName)
      The name of the content. For instance 'Ad Foo Bar'
    • setContentPiece

      public void setContentPiece(String contentPiece)
      The actual content piece. For instance the path to an image, video, audio, any text
    • setContentTarget

      public void setContentTarget(String contentTarget)
      The target of the content. For instance the URL of a landing page
    • setContentInteraction

      public void setContentInteraction(String contentInteraction)
      The name of the interaction with the content. For instance a 'click'
    • setEcommerceId

      public void setEcommerceId(String ecommerceId)
      The unique string identifier for the ecommerce order (required when tracking an ecommerce order).
    • setEcommerceItems

      public void setEcommerceItems(EcommerceItems ecommerceItems)
      Items in the Ecommerce order.
    • setEcommerceSubtotal

      public void setEcommerceSubtotal(Double ecommerceSubtotal)
      The subtotal of the order; excludes shipping.
    • setEcommerceTax

      public void setEcommerceTax(Double ecommerceTax)
      Tax amount of the order.
    • setEcommerceShippingCost

      public void setEcommerceShippingCost(Double ecommerceShippingCost)
      Shipping cost of the order.
    • setEcommerceDiscount

      public void setEcommerceDiscount(Double ecommerceDiscount)
      Discount offered.
    • setEcommerceLastOrderTimestamp

      public void setEcommerceLastOrderTimestamp(Instant ecommerceLastOrderTimestamp)
      The UNIX timestamp of this customer's last ecommerce order. This value is used to process the "Days since last order" report.
    • setEcommerceProductSku

      public void setEcommerceProductSku(String ecommerceProductSku)
      The SKU of the product being viewed. Used for ecommerce product page tracking.

      Requires idgoal=0 and _pks to be set.

    • setEcommerceProductName

      public void setEcommerceProductName(String ecommerceProductName)
      The name of the product being viewed. Used for ecommerce product page tracking.

      Requires idgoal=0 and _pks to be set.

    • setEcommerceProductCategory

      public void setEcommerceProductCategory(String ecommerceProductCategory)
      The category of the product being viewed. Used for ecommerce product page tracking.

      Can be a string or a JSON-encoded array of up to five category names.

      Requires idgoal=0 and _pks to be set.

    • setEcommerceProductPrice

      public void setEcommerceProductPrice(Double ecommerceProductPrice)
      The price of the product being viewed. Used for ecommerce product page tracking.

      Requires idgoal=0 and _pks to be set.

    • setAuthToken

      public void setAuthToken(String authToken)
      32 character authorization key used to authenticate the API request. We recommend to create a user specifically for accessing the Tracking API, and give the user only write permission on the website(s).
    • setVisitorIp

      public void setVisitorIp(String visitorIp)
      Override value for the visitor IP (both IPv4 and IPv6 notations supported).
    • setRequestTimestamp

      public void setRequestTimestamp(Instant requestTimestamp)
      Override for the datetime of the request (normally the current time is used). This can be used to record visits and page views in the past.
    • setVisitorCountry

      public void setVisitorCountry(Country visitorCountry)
      An override value for the country. Must be a two-letter ISO 3166 Alpha-2 country code.
    • setVisitorRegion

      public void setVisitorRegion(String visitorRegion)
      An override value for the region. Should be set to a ISO 3166-2 region code, which are used by MaxMind's and DB-IP's GeoIP2 databases. See here for a list of them for every country.
    • setVisitorCity

      public void setVisitorCity(String visitorCity)
      An override value for the city. The name of the city the visitor is located in, eg, Tokyo.
    • setVisitorLatitude

      public void setVisitorLatitude(Double visitorLatitude)
      An override value for the visitor's latitude, eg 22.456.
    • setVisitorLongitude

      public void setVisitorLongitude(Double visitorLongitude)
      An override value for the visitor's longitude, eg 22.456.
    • setQueuedTracking

      public void setQueuedTracking(Boolean queuedTracking)
      When set to false, the queued tracking handler won't be used and instead the tracking request will be executed directly. This can be useful when you need to debug a tracking problem or want to test that the tracking works in general.
    • setResponseAsImage

      public void setResponseAsImage(Boolean responseAsImage)
      If set to 0 (send_image=0) Matomo will respond with an HTTP 204 response code instead of a GIF image. This improves performance and can fix errors if images are not allowed to be obtained directly (like Chrome Apps). Available since Matomo 2.10.0

      Default is false

    • setPing

      public void setPing(Boolean ping)
      If set to true, the request will be a Heartbeat request which will not track any new activity (such as a new visit, new action or new goal). The heartbeat request will only update the visit's total time to provide accurate "Visit duration" metric when this parameter is set. It won't record any other data. This means by sending an additional tracking request when the user leaves your site or app with &ping=1, you fix the issue where the time spent of the last page visited is reported as 0 seconds.
    • setTrackBotRequests

      public void setTrackBotRequests(Boolean trackBotRequests)
      By default, Matomo does not track bots. If you use the Tracking HTTP API directly, you may be interested in tracking bot requests.
    • setBotRecordingMode

      public void setBotRecordingMode(Integer botRecordingMode)
      When bots=1 is set, this specifies the recording mode for bot requests.

      Set to 1 to record bot requests without triggering any goals, events or actions.

    • setHttpStatusCode

      public void setHttpStatusCode(Integer httpStatusCode)
      The HTTP status code of the tracked request. Used with bot tracking.

      When tracking a bot visit, this can be set to the HTTP status code of the bot's request.

    • setBandwidthBytes

      public void setBandwidthBytes(Long bandwidthBytes)
      The bandwidth used for the tracked request in bytes. Used with bot tracking.
    • setSourceLabel

      public void setSourceLabel(String sourceLabel)
      Defines the source of the tracking request (e.g., "backend" or "mobile-app").

      Used to classify where the tracking hit originated.

    • setRandomValue

      public void setRandomValue(RandomValue randomValue)
      Meant to hold a random value that is generated before each request. Using it helps avoid the tracking request being cached by the browser or a proxy.
    • setDebug

      public void setDebug(Boolean debug)
      Meant to hold a random value that is generated before each request. Using it helps avoid the tracking request being cached by the browser or a proxy.
    • setMediaId

      public void setMediaId(String mediaId)
      A unique ID used to identify the media. Part of the Media Analytics plugin.
    • setMediaTitle

      public void setMediaTitle(String mediaTitle)
      The title of the media resource. Part of the Media Analytics plugin.
    • setMediaResource

      public void setMediaResource(String mediaResource)
      The URL of the media resource. Part of the Media Analytics plugin.
    • setMediaType

      public void setMediaType(String mediaType)
      The type of media, e.g. "video" or "audio". Part of the Media Analytics plugin.
    • setMediaPlayerName

      public void setMediaPlayerName(String mediaPlayerName)
      The name of the media player used to play the media, e.g. "html5". Part of the Media Analytics plugin.
    • setMediaTimeSpent

      public void setMediaTimeSpent(Integer mediaTimeSpent)
      The number of seconds the visitor has spent playing/watching the media resource so far. Part of the Media Analytics plugin.
    • setMediaLength

      public void setMediaLength(Integer mediaLength)
      The total duration / length of the media resource in seconds. Part of the Media Analytics plugin.
    • setMediaProgressPercent

      public void setMediaProgressPercent(Integer mediaProgressPercent)
      The current progress of the media in percent (0–100). Part of the Media Analytics plugin.
    • setMediaTimeToPlay

      public void setMediaTimeToPlay(Integer mediaTimeToPlay)
      How many seconds it took before the media started playing. Part of the Media Analytics plugin.
    • setMediaWidth

      public void setMediaWidth(Integer mediaWidth)
      The width of the media player in pixels. Part of the Media Analytics plugin.
    • setMediaHeight

      public void setMediaHeight(Integer mediaHeight)
      The height of the media player in pixels. Part of the Media Analytics plugin.
    • setMediaFullscreen

      public void setMediaFullscreen(Boolean mediaFullscreen)
      Whether the media is currently displayed in fullscreen. Part of the Media Analytics plugin.
    • setMediaSegmentsViewed

      public void setMediaSegmentsViewed(String mediaSegmentsViewed)
      A JSON-encoded array of which positions in the media were viewed by the visitor. Part of the Media Analytics plugin.

      Example: [[0,15],[30,44]] means the visitor watched segments 0–15s and 30–44s.

    • setCrashMessage

      public void setCrashMessage(String crashMessage)
      Contains an error message describing the error that occurred during the last tracking request.

      Custom action must be enabled for this.

      Required for crash analytics

    • setCrashType

      public void setCrashType(String crashType)
      The type of exception that occurred during the last tracking request.

      Custom action must be enabled for this.

      Typically a fully qualified class name of the exception, e.g. java.lang.NullPointerException.

      Optional for crash analytics

    • setCrashCategory

      public void setCrashCategory(String crashCategory)
      Category of a crash to group crashes by.

      Custom action must be enabled for this.

      Optional for crash analytics

    • setCrashStackTrace

      public void setCrashStackTrace(String crashStackTrace)
      A stack trace of the exception that occurred during the last tracking request.

      Custom action must be enabled for this.

      Optional for crash analytics

    • setCrashLocation

      public void setCrashLocation(String crashLocation)
      The originating source of the crash.

      Could be a source file URI or something similar

      Custom action must be enabled for this.

      Optional for crash analytics

    • setCrashLine

      public void setCrashLine(Integer crashLine)
      The line number of the crash source, where the crash occurred.

      Custom action must be enabled for this.

      Optional for crash analytics

    • setCrashColumn

      public void setCrashColumn(Integer crashColumn)
      The column within the line where the crash occurred.

      Optional for crash analytics

    • setSessionId

      public void setSessionId(String sessionId)
      The Matomo session ID sent as a cookie MATOMO_SESSID.

      If not null a cookie with the name MATOMO_SESSID will be sent with the value of this parameter.

    • setDimensions

      public void setDimensions(Map<Long,Object> dimensions)
      Custom Dimension values for specific Custom Dimension IDs.

      Custom Dimensions plugin must be installed. See the Custom Dimensions guide. Requires Matomo at least 2.15.1

    • setAdditionalParameters

      public void setAdditionalParameters(Map<String,Object> additionalParameters)
      Allows you to specify additional HTTP request parameters that will be sent to Matomo.

      For example, you can use this to set the Accept-Language header, or to set the Content-Type.

    • setHeaders

      public void setHeaders(Map<String,String> headers)
      You can set additional HTTP headers for the request sent to Matomo.

      For example, you can use this to set the Accept-Language header, or to set the Content-Type.

    • setCookies

      public void setCookies(Map<String,String> cookies)
      Appends additional cookies to the request.

      This allows you to add Matomo specific cookies, like _pk_id or _pk_sess coming from Matomo responses to the request.

    • toString

      public String toString()
      Overrides:
      toString in class Object