Class MatomoRequest
- Direct Known Subclasses:
PiwikRequest
MatomoTracker
.- Author:
- brettcsorba
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMatomoRequest
(int siteId, String actionUrl) Deprecated.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, 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 authToken, String visitorIp, Instant requestTimestamp, Country visitorCountry, String visitorRegion, String visitorCity, Double visitorLatitude, Double visitorLongitude, Boolean queuedTracking, Boolean responseAsImage, Boolean ping, Boolean trackBotRequests, RandomValue randomValue, Boolean debug, String crashMessage, String crashType, String crashCategory, String crashStackTrace, String crashLocation, Integer crashLine, Integer crashColumn, String sessionId, Map<Long, Object> dimensions, Map<String, Collection<Object>> additionalParameters, Map<String, String> headers, Map<String, String> cookies) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCustomTrackingParameter
(@NonNull String key, @NonNull Object value) Deprecated.void
addEcommerceItem
(@NonNull EcommerceItem item) Deprecated.Use @linkMatomoRequest.MatomoRequestBuilder.ecommerceItems(EcommerceItems)
insteadstatic MatomoRequestBuilder
builder()
Deprecated.Userequest()
instead.void
Deprecated.Please useMatomoRequest.MatomoRequestBuilder.additionalParameters(Map)
instead so that you can manage the map yourself.void
Deprecated.Use @linkMatomoRequest.MatomoRequestBuilder.ecommerceItems(EcommerceItems)
insteadvoid
Deprecated.Please usesetGoalId(Integer)
insteadThe title of the action being tracked.The full URL for the current action.Allows you to specify additional HTTP request parameters that will be sent to Matomo.Defines the API version to use (default: 1).32 character authorization key used to authenticate the API request.The campaign keyword (see Tracking Campaigns).The campaign name.The charset of the page being tracked.The name of the interaction with the content.The name of the content.The actual content piece.The target of the content.Appends additional cookies to the request.Category of a crash to group crashes by.The column within the line where the crash occurred.The line number of the crash source, where the crash occurred.The originating source of the crash.Contains an error message describing the error that occurred during the last tracking request.A stack trace of the exception that occurred during the last tracking request.The type of exception that occurred during the last tracking request.The current hour (local time).The current minute (local time).The current second (local time).can be optionally sent along any tracking request that isn't a page view.getCustomTrackingParameter
(@NonNull String key) Gets the list of objects currently stored at the specified custom tracking parameter.getDebug()
Meant to hold a random value that is generated before each request.The resolution of the device the visitor is using.Custom Dimension values for specific Custom Dimension IDs.How long it takes for the browser to load media and execute any Javascript code listening for the DOMContentLoaded event.How long the browser spends loading the webpage after the response was fully received until the user can start interacting with it.URL of a file the user has downloaded.Discount offered.he unique string identifier for the ecommerce order (required when tracking an ecommerce order).getEcommerceItem
(int index) Deprecated.Use @linkMatomoRequest.MatomoRequestBuilder.ecommerceItems(EcommerceItems)
insteadItems in the Ecommerce order.The UNIX timestamp of this customer's last ecommerce order.The grand total for the ecommerce order (required when tracking an ecommerce order).Shipping cost of the order.The subtotal of the order; excludes shipping.Tax amount of the order.An event action like Play, Pause, Duration, Add Playlist, Downloaded, Clicked...eg.The event name for example a Movie name, or Song name, or File name...Some numeric value that represents the event value.If specified, the tracking request will trigger a conversion for the goal of the website being tracked with this ID.An override value for the Accept-Language HTTP header field.You can set additional HTTP headers for the request sent to Matomo.An override value for the User-Agent HTTP header field.How long it took to connect to server.will force a new visit to be created for this action.Tracks if the visitor is a returning visitor.How long it takes the browser to execute Javascript code waiting for the window.load event.An external URL the user has opened.getPageCustomVariable
(int index) Deprecated.UsegetPageCustomVariables()
insteadDeprecated.Use thegetPageCustomVariables()
method instead.Custom variables are custom name-value pairs that you can assign to your visitors (or page views).Accepts a six character unique ID that identifies which actions were performed on a specific page view.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).Does the visitor use Director plugin.Does the visitor use the Adobe Flash Plugin.Does the visitor use a Gears plugin.Does the visitor use the Java plugin.Does the visitor use a PDF plugin.Does the visitor use Quicktime plugin.Does the visitor use Realplayer plugin.Does the visitor use a Silverlight plugin.Does the visitor use a Windows Media plugin.When set to false, the queued tracking handler won't be used and instead the tracking request will be executed directly.Meant to hold a random value that is generated before each request.The full HTTP Referrer URL.Deprecated.UsegetRequestTimestamp()
insteadOverride for the datetime of the request (normally the current time is used).The ID of the website we're tracking a visit/action for.If set to 0 (send_image=0) Matomo will respond with an HTTP 204 response code instead of a GIF image.When search is specified, you can optionally specify a search category with this parameter.The Site Search keyword.When search is specified, we also recommend setting the search_count to the number of search results displayed on the results page.How long it took the server to generate page.The Matomo session ID sent as a cookieMATOMO_SESSID
.The ID of the website we're tracking a visit/action for.Does the visitor's client is known to support cookies.By default, Matomo does not track bots.How long it takes the browser to download the response from the server.Deprecated.Use thegetVisitCustomVariables()
method instead.Defines the User ID for this request.getVisitCustomVariable
(int index) Deprecated.UsegetVisitCustomVariables()
insteadCustom variables are custom name-value pairs that you can assign to your visitors (or page views).An override value for the city.An override value for the country.defines the visitor ID for this request.The UNIX timestamp of this visitor's first visit.The unique visitor ID.Override value for the visitor IP (both IPv4 and IPv6 notations supported).An override value for the visitor's latitude, eg 22.456.An override value for the visitor's longitude, eg 22.456.The UNIX timestamp of this visitor's previous visit.An override value for the region.The current count of visits for this visitor.request()
void
setActionName
(String actionName) The title of the action being tracked.void
setActionUrl
(String actionUrl) The full URL for the current action.void
setAdditionalParameters
(Map<String, Collection<Object>> additionalParameters) Allows you to specify additional HTTP request parameters that will be sent to Matomo.void
setApiVersion
(String apiVersion) Defines the API version to use (default: 1).void
setAuthToken
(String authToken) 32 character authorization key used to authenticate the API request.void
setCampaignKeyword
(String campaignKeyword) The campaign keyword (see Tracking Campaigns).void
setCampaignName
(String campaignName) The campaign name.void
setCharacterSet
(Charset characterSet) The charset of the page being tracked.void
setContentInteraction
(String contentInteraction) The name of the interaction with the content.void
setContentName
(String contentName) The name of the content.void
setContentPiece
(String contentPiece) The actual content piece.void
setContentTarget
(String contentTarget) The target of the content.void
setCookies
(Map<String, String> cookies) Appends additional cookies to the request.void
setCrashCategory
(String crashCategory) Category of a crash to group crashes by.void
setCrashColumn
(Integer crashColumn) The column within the line where the crash occurred.void
setCrashLine
(Integer crashLine) The line number of the crash source, where the crash occurred.void
setCrashLocation
(String crashLocation) The originating source of the crash.void
setCrashMessage
(String crashMessage) Contains an error message describing the error that occurred during the last tracking request.void
setCrashStackTrace
(String crashStackTrace) A stack trace of the exception that occurred during the last tracking request.void
setCrashType
(String crashType) The type of exception that occurred during the last tracking request.void
setCurrentHour
(Integer currentHour) The current hour (local time).void
setCurrentMinute
(Integer currentMinute) The current minute (local time).void
setCurrentSecond
(Integer currentSecond) The current second (local time).void
setCustomAction
(Boolean customAction) can be optionally sent along any tracking request that isn't a page view.void
setCustomTrackingParameter
(@NonNull String key, Object value) Deprecated.void
Meant to hold a random value that is generated before each request.void
setDeviceResolution
(String deviceResolution) Deprecated.UsesetDeviceResolution(DeviceResolution)
instead.void
setDeviceResolution
(DeviceResolution deviceResolution) The resolution of the device the visitor is using.void
setDimensions
(Map<Long, Object> dimensions) Custom Dimension values for specific Custom Dimension IDs.void
setDomCompletionTime
(Long domCompletionTime) How long it takes for the browser to load media and execute any Javascript code listening for the DOMContentLoaded event.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.void
setDownloadUrl
(String downloadUrl) URL of a file the user has downloaded.void
setEcommerceDiscount
(Double ecommerceDiscount) Discount offered.void
setEcommerceId
(String ecommerceId) he unique string identifier for the ecommerce order (required when tracking an ecommerce order).void
setEcommerceItems
(EcommerceItems ecommerceItems) Items in the Ecommerce order.void
setEcommerceLastOrderTimestamp
(Instant ecommerceLastOrderTimestamp) The UNIX timestamp of this customer's last ecommerce order.void
setEcommerceRevenue
(Double ecommerceRevenue) The grand total for the ecommerce order (required when tracking an ecommerce order).void
setEcommerceShippingCost
(Double ecommerceShippingCost) Shipping cost of the order.void
setEcommerceSubtotal
(Double ecommerceSubtotal) The subtotal of the order; excludes shipping.void
setEcommerceTax
(Double ecommerceTax) Tax amount of the order.void
setEventAction
(String eventAction) An event action like Play, Pause, Duration, Add Playlist, Downloaded, Clicked...void
setEventCategory
(String eventCategory) eg.void
setEventName
(String eventName) The event name for example a Movie name, or Song name, or File name...void
setEventValue
(Double eventValue) Some numeric value that represents the event value.void
If specified, the tracking request will trigger a conversion for the goal of the website being tracked with this ID.void
setHeaderAcceptLanguage
(AcceptLanguage headerAcceptLanguage) An override value for the Accept-Language HTTP header field.void
setHeaders
(Map<String, String> headers) You can set additional HTTP headers for the request sent to Matomo.void
setHeaderUserAgent
(String headerUserAgent) An override value for the User-Agent HTTP header field.void
setNetworkTime
(Long networkTime) How long it took to connect to server.void
setNewVisit
(Boolean newVisit) will force a new visit to be created for this action.void
setNewVisitor
(Boolean newVisitor) Tracks if the visitor is a returning visitor.void
setOnloadTime
(Long onloadTime) How long it takes the browser to execute Javascript code waiting for the window.load event.void
setOutlinkUrl
(String outlinkUrl) An external URL the user has opened.void
setPageCustomVariable
(@NonNull String key, String value) Deprecated.UsegetPageCustomVariables()
insteadvoid
setPageCustomVariable
(CustomVariable customVariable, int index) Deprecated.UsegetPageCustomVariables()
insteadvoid
setPageCustomVariables
(CustomVariables pageCustomVariables) Custom variables are custom name-value pairs that you can assign to your visitors (or page views).void
setPageViewId
(UniqueId pageViewId) Accepts a six character unique ID that identifies which actions were performed on a specific page view.void
setParameter
(@NonNull String parameterName, Object value) Deprecated.Use @linkMatomoRequest.MatomoRequestBuilder.additionalParameters(Map)
insteadvoid
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).void
setPluginDirector
(Boolean pluginDirector) Does the visitor use Director plugin.void
setPluginFlash
(Boolean pluginFlash) Does the visitor use the Adobe Flash Plugin.void
setPluginGears
(Boolean pluginGears) Does the visitor use a Gears plugin.void
setPluginJava
(Boolean pluginJava) Does the visitor use the Java plugin.void
setPluginPDF
(Boolean pluginPDF) Does the visitor use a PDF plugin.void
setPluginQuicktime
(Boolean pluginQuicktime) Does the visitor use Quicktime plugin.void
setPluginRealPlayer
(Boolean pluginRealPlayer) Does the visitor use Realplayer plugin.void
setPluginSilverlight
(Boolean pluginSilverlight) Does the visitor use a Silverlight plugin.void
setPluginWindowsMedia
(Boolean pluginWindowsMedia) Does the visitor use a Windows Media plugin.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.void
setRandomValue
(RandomValue randomValue) Meant to hold a random value that is generated before each request.void
setReferrerUrl
(String referrerUrl) The full HTTP Referrer URL.void
setRequestDatetime
(MatomoDate matomoDate) Deprecated.UsesetRequestTimestamp(Instant)
insteadvoid
setRequestTimestamp
(Instant requestTimestamp) Override for the datetime of the request (normally the current time is used).void
setRequired
(Boolean required) The ID of the website we're tracking a visit/action for.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.void
setSearchCategory
(String searchCategory) When search is specified, you can optionally specify a search category with this parameter.void
setSearchQuery
(String searchQuery) The Site Search keyword.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.void
setServerTime
(Long serverTime) How long it took the server to generate page.void
setSessionId
(String sessionId) The Matomo session ID sent as a cookieMATOMO_SESSID
.void
The ID of the website we're tracking a visit/action for.void
setSupportsCookies
(Boolean supportsCookies) Does the visitor's client is known to support cookies.void
setTrackBotRequests
(Boolean trackBotRequests) By default, Matomo does not track bots.void
setTransferTime
(Long transferTime) How long it takes the browser to download the response from the server.void
setUserCustomVariable
(@NonNull String key, String value) Deprecated.UsesetVisitCustomVariables(CustomVariables)
insteadvoid
Defines the User ID for this request.void
setVisitCustomVariable
(CustomVariable customVariable, int index) Deprecated.UsesetVisitCustomVariables(CustomVariables)
insteadvoid
setVisitCustomVariables
(CustomVariables visitCustomVariables) Custom variables are custom name-value pairs that you can assign to your visitors (or page views).void
setVisitorCity
(String visitorCity) An override value for the city.void
setVisitorCountry
(Country visitorCountry) An override value for the country.void
setVisitorCustomId
(VisitorId visitorCustomId) defines the visitor ID for this request.void
setVisitorFirstVisitTimestamp
(Instant visitorFirstVisitTimestamp) The UNIX timestamp of this visitor's first visit.void
setVisitorId
(VisitorId visitorId) The unique visitor ID.void
setVisitorIp
(String visitorIp) Override value for the visitor IP (both IPv4 and IPv6 notations supported).void
setVisitorLatitude
(Double visitorLatitude) An override value for the visitor's latitude, eg 22.456.void
setVisitorLongitude
(Double visitorLongitude) An override value for the visitor's longitude, eg 22.456.void
setVisitorPreviousVisitTimestamp
(Instant visitorPreviousVisitTimestamp) The UNIX timestamp of this visitor's previous visit.void
setVisitorRegion
(String visitorRegion) An override value for the region.void
setVisitorVisitCount
(Integer visitorVisitCount) The current count of visits for this visitor.toString()
-
Constructor Details
-
MatomoRequest
Deprecated.Please userequest()
Create a new request from the id of the site being tracked and the full url for the current action. This constructor also sets:Required = true Visior Id = random 16 character hex string Random Value = random 20 character hex string API version = 1 Response as Image = false
- Parameters:
siteId
- the id of the website we're tracking a visit/action foractionUrl
- the full URL for the current action
-
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, 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 authToken, String visitorIp, Instant requestTimestamp, Country visitorCountry, String visitorRegion, String visitorCity, Double visitorLatitude, Double visitorLongitude, Boolean queuedTracking, Boolean responseAsImage, Boolean ping, Boolean trackBotRequests, RandomValue randomValue, Boolean debug, String crashMessage, String crashType, String crashCategory, String crashStackTrace, String crashLocation, Integer crashLine, Integer crashColumn, String sessionId, Map<Long, Object> dimensions, Map<String, Collection<Object>> additionalParameters, Map<String, String> headers, Map<String, String> cookies)
-
-
Method Details
-
getCustomTrackingParameter
Gets the list of objects currently stored at the specified custom tracking parameter. An empty list will be returned if there are no objects set at that key.- Parameters:
key
- the key of the parameter whose list of objects to get. Cannot be null- Returns:
- the list of objects currently stored at the specified key
-
setCustomTrackingParameter
@Deprecated public void setCustomTrackingParameter(@NonNull @NonNull String key, @Nullable Object value) Deprecated.Set a custom tracking parameter whose toString() value will be sent to the Matomo server. These parameters are stored separately from named Matomo parameters, meaning it is not possible to overwrite or clear named Matomo parameters with this method. A custom parameter that has the same name as a named Matomo parameter will be sent in addition to that named parameter.- Parameters:
key
- the parameter's key. Cannot be nullvalue
- the parameter's value. Removes the parameter if null
-
addCustomTrackingParameter
@Deprecated public void addCustomTrackingParameter(@NonNull @NonNull String key, @NonNull @NonNull Object value) Deprecated.Add a custom tracking parameter to the specified key. This allows users to have multiple parameters with the same name and different values, commonly used during situations where list parameters are needed- Parameters:
key
- the parameter's key. Cannot be nullvalue
- the parameter's value. Cannot be null
-
clearCustomTrackingParameter
Deprecated.Please useMatomoRequest.MatomoRequestBuilder.additionalParameters(Map)
instead so that you can manage the map yourself.Removes all custom tracking parameters. -
enableEcommerce
Deprecated.Please usesetGoalId(Integer)
insteadSets idgoal=0 in the request to track an ecommerce interaction: cart update or an ecommerce order. -
getEcommerceItem
Deprecated.Use @linkMatomoRequest.MatomoRequestBuilder.ecommerceItems(EcommerceItems)
insteadGet theEcommerceItem
at the specified index.- Parameters:
index
- the index of theEcommerceItem
to return- Returns:
- the
EcommerceItem
at the specified index
-
addEcommerceItem
Deprecated.Use @linkMatomoRequest.MatomoRequestBuilder.ecommerceItems(EcommerceItems)
insteadAdd anEcommerceItem
to this order. Ecommerce must be enabled, and EcommerceId and EcommerceRevenue must first be set.- Parameters:
item
- theEcommerceItem
to add. Cannot be null
-
clearEcommerceItems
Deprecated.Use @linkMatomoRequest.MatomoRequestBuilder.ecommerceItems(EcommerceItems)
insteadClears allEcommerceItem
from this order. -
getPageCustomVariable
Deprecated.Use thegetPageCustomVariables()
method instead.Get the page custom variable at the specified key.- Parameters:
key
- the key of the variable to get- Returns:
- the variable at the specified key, null if key is not present
-
getPageCustomVariable
Deprecated.UsegetPageCustomVariables()
insteadGet the page custom variable at the specified index.- Parameters:
index
- the index of the variable to get. Must be greater than 0- Returns:
- the variable at the specified key, null if nothing at this index
-
setPageCustomVariable
Deprecated.UsegetPageCustomVariables()
insteadSet a page custom variable with the specified key and value at the first available index. All page custom variables with this key will be overwritten or deleted- Parameters:
key
- the key of the variable to setvalue
- the value of the variable to set at the specified key. A null value will remove this custom variable
-
setPageCustomVariable
Deprecated.UsegetPageCustomVariables()
insteadSet a page custom variable at the specified index.- Parameters:
customVariable
- the CustomVariable to set. A null value will remove the CustomVariable at the specified indexindex
- the index of he CustomVariable to set
-
getRequestDatetime
Deprecated.UsegetRequestTimestamp()
insteadGet the datetime of the request.- Returns:
- the datetime of the request
-
setRequestDatetime
Deprecated.UsesetRequestTimestamp(Instant)
insteadSet the datetime of the request (normally the current time is used). This can be used to record visits and page views in the past. The datetime must be sent in UTC timezone. Note: if you record data in the past, you will need to force Matomo to re-process reports for the past dates. If you set the Request Datetime to a datetime older than four hours then Auth Token must be set. If you set Request Datetime with a datetime in the last four hours then you don't need to pass Auth Token.- Parameters:
matomoDate
- the datetime of the request to set. A null value will remove this parameter
-
getUserCustomVariable
Deprecated.Use thegetVisitCustomVariables()
method instead.Get the visit custom variable at the specified key.- Parameters:
key
- the key of the variable to get- Returns:
- the variable at the specified key, null if key is not present
-
getVisitCustomVariable
Deprecated.UsegetVisitCustomVariables()
insteadGet the visit custom variable at the specified index.- Parameters:
index
- the index of the variable to get- Returns:
- the variable at the specified index, null if nothing at this index
-
setUserCustomVariable
Deprecated.UsesetVisitCustomVariables(CustomVariables)
insteadSet a visit custom variable with the specified key and value at the first available index. All visit custom variables with this key will be overwritten or deleted- Parameters:
key
- the key of the variable to setvalue
- the value of the variable to set at the specified key. A null value will remove this parameter
-
setVisitCustomVariable
Deprecated.UsesetVisitCustomVariables(CustomVariables)
insteadSet a user custom variable at the specified key.- Parameters:
customVariable
- the CustomVariable to set. A null value will remove the custom variable at the specified indexindex
- the index to set the customVariable at.
-
setParameter
Deprecated.Use @linkMatomoRequest.MatomoRequestBuilder.additionalParameters(Map)
insteadSets a custom parameter to append to the Matomo tracking parameters.Attention: If a parameter with the same name already exists, it will be appended twice!
- Parameters:
parameterName
- The name of the query parameter to append. Must not be null or empty.value
- The value of the query parameter to append. To remove the parameter, pass null.
-
builder
Deprecated.Userequest()
instead.Creates a newMatomoRequest.MatomoRequestBuilder
instance. Only here for backwards compatibility. -
setDeviceResolution
Deprecated.UsesetDeviceResolution(DeviceResolution)
instead.Parses the given device resolution string and sets thedeviceResolution
field.- Parameters:
deviceResolution
- the device resolution string to parse. Format: "WIDTHxHEIGHT"
-
request
-
getRequired
The ID of the website we're tracking a visit/action for. Only needed, if no default site id is configured -
getSiteId
The ID of the website we're tracking a visit/action for. Only needed, if no default site id is configured -
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
The full URL for the current action. -
getApiVersion
Defines the API version to use (default: 1). -
getVisitorId
The unique visitor ID. SeeVisitorId
. Default isVisitorId.random()
Since version 3.0.0 this parameter is of type
VisitorId
and not a String anymore. UseVisitorId.fromHex(String)
to create a VisitorId from a hex string,VisitorId.fromUUID(UUID)
to create it from a UUID orVisitorId.fromHash(long)
to create it from a long value. -
getNewVisitor
Tracks if the visitor is a returning visitor.This is done by storing a visitor ID in a 1st party cookie.
-
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
Custom variables are custom name-value pairs that you can assign to your visitors (or page views). -
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
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
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
The campaign name. This parameter will only be used for the first pageview of a visit. -
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
The resolution of the device the visitor is using. -
getCurrentHour
The current hour (local time). -
getCurrentMinute
The current minute (local time). -
getCurrentSecond
The current second (local time). -
getPluginFlash
Does the visitor use the Adobe Flash Plugin. -
getPluginJava
Does the visitor use the Java plugin. -
getPluginDirector
Does the visitor use Director plugin. -
getPluginQuicktime
Does the visitor use Quicktime plugin. -
getPluginRealPlayer
Does the visitor use Realplayer plugin. -
getPluginPDF
Does the visitor use a PDF plugin. -
getPluginWindowsMedia
Does the visitor use a Windows Media plugin. -
getPluginGears
Does the visitor use a Gears plugin. -
getPluginSilverlight
Does the visitor use a Silverlight plugin. -
getSupportsCookies
Does the visitor's client is known to support cookies. -
getHeaderUserAgent
An override value for the User-Agent HTTP header field. -
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
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
defines the visitor ID for this request. -
getNewVisit
will force a new visit to be created for this action. -
getPageCustomVariables
Custom variables are custom name-value pairs that you can assign to your visitors (or page views). -
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
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
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
When search is specified, you can optionally specify a search category with this parameter. -
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
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
If specified, the tracking request will trigger a conversion for the goal of the website being tracked with this ID. -
getEcommerceRevenue
The grand total for the ecommerce order (required when tracking an ecommerce order). -
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
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
How long it took to connect to server. -
getServerTime
How long it took the server to generate page. -
getTransferTime
How long it takes the browser to download the response from the server. -
getDomProcessingTime
How long the browser spends loading the webpage after the response was fully received until the user can start interacting with it. -
getDomCompletionTime
How long it takes for the browser to load media and execute any Javascript code listening for the DOMContentLoaded event. -
getOnloadTime
How long it takes the browser to execute Javascript code waiting for the window.load event. -
getEventCategory
eg. Videos, Music, Games... -
getEventAction
An event action like Play, Pause, Duration, Add Playlist, Downloaded, Clicked... -
getEventName
The event name for example a Movie name, or Song name, or File name... -
getEventValue
Some numeric value that represents the event value. -
getContentName
The name of the content. For instance 'Ad Foo Bar' -
getContentPiece
The actual content piece. For instance the path to an image, video, audio, any text -
getContentTarget
The target of the content. For instance the URL of a landing page -
getContentInteraction
The name of the interaction with the content. For instance a 'click' -
getEcommerceId
he unique string identifier for the ecommerce order (required when tracking an ecommerce order). you must set &idgoal=0 in the request to track an ecommerce interaction: cart update or an ecommerce order. -
getEcommerceItems
Items in the Ecommerce order. -
getEcommerceSubtotal
The subtotal of the order; excludes shipping. -
getEcommerceTax
Tax amount of the order. -
getEcommerceShippingCost
Shipping cost of the order. -
getEcommerceDiscount
Discount offered. -
getEcommerceLastOrderTimestamp
The UNIX timestamp of this customer's last ecommerce order. This value is used to process the "Days since last order" report. -
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
Override value for the visitor IP (both IPv4 and IPv6 notations supported). -
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
An override value for the country. Must be a two-letter ISO 3166 Alpha-2 country code. -
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
An override value for the city. The name of the city the visitor is located in, eg, Tokyo. -
getVisitorLatitude
An override value for the visitor's latitude, eg 22.456. -
getVisitorLongitude
An override value for the visitor's longitude, eg 22.456. -
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
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.0Default is
false
-
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
By default, Matomo does not track bots. If you use the Tracking HTTP API directly, you may be interested in tracking bot requests. -
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
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. -
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
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
Category of a crash to group crashes by.Custom action must be enabled for this.
Optional for crash analytics
-
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
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
The line number of the crash source, where the crash occurred.Custom action must be enabled for this.
Optional for crash analytics
-
getCrashColumn
The column within the line where the crash occurred.Optional for crash analytics
-
getSessionId
The Matomo session ID sent as a cookieMATOMO_SESSID
.If not null a cookie with the name
MATOMO_SESSID
will be sent with the value of this parameter. -
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
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
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
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
The ID of the website we're tracking a visit/action for. Only needed, if no default site id is configured -
setSiteId
The ID of the website we're tracking a visit/action for. Only needed, if no default site id is configured -
setActionName
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
The full URL for the current action. -
setApiVersion
Defines the API version to use (default: 1). -
setVisitorId
The unique visitor ID. SeeVisitorId
. Default isVisitorId.random()
Since version 3.0.0 this parameter is of type
VisitorId
and not a String anymore. UseVisitorId.fromHex(String)
to create a VisitorId from a hex string,VisitorId.fromUUID(UUID)
to create it from a UUID orVisitorId.fromHash(long)
to create it from a long value. -
setNewVisitor
Tracks if the visitor is a returning visitor.This is done by storing a visitor ID in a 1st party cookie.
-
setReferrerUrl
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
Custom variables are custom name-value pairs that you can assign to your visitors (or page views). -
setVisitorVisitCount
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
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
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
The campaign name. This parameter will only be used for the first pageview of a visit. -
setCampaignKeyword
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
The resolution of the device the visitor is using. -
setCurrentHour
The current hour (local time). -
setCurrentMinute
The current minute (local time). -
setCurrentSecond
The current second (local time). -
setPluginFlash
Does the visitor use the Adobe Flash Plugin. -
setPluginJava
Does the visitor use the Java plugin. -
setPluginDirector
Does the visitor use Director plugin. -
setPluginQuicktime
Does the visitor use Quicktime plugin. -
setPluginRealPlayer
Does the visitor use Realplayer plugin. -
setPluginPDF
Does the visitor use a PDF plugin. -
setPluginWindowsMedia
Does the visitor use a Windows Media plugin. -
setPluginGears
Does the visitor use a Gears plugin. -
setPluginSilverlight
Does the visitor use a Silverlight plugin. -
setSupportsCookies
Does the visitor's client is known to support cookies. -
setHeaderUserAgent
An override value for the User-Agent HTTP header field. -
setHeaderAcceptLanguage
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
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
defines the visitor ID for this request. -
setNewVisit
will force a new visit to be created for this action. -
setPageCustomVariables
Custom variables are custom name-value pairs that you can assign to your visitors (or page views). -
setOutlinkUrl
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
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
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
When search is specified, you can optionally specify a search category with this parameter. -
setSearchResultsCount
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
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
If specified, the tracking request will trigger a conversion for the goal of the website being tracked with this ID. -
setEcommerceRevenue
The grand total for the ecommerce order (required when tracking an ecommerce order). -
setCharacterSet
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
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
How long it took to connect to server. -
setServerTime
How long it took the server to generate page. -
setTransferTime
How long it takes the browser to download the response from the server. -
setDomProcessingTime
How long the browser spends loading the webpage after the response was fully received until the user can start interacting with it. -
setDomCompletionTime
How long it takes for the browser to load media and execute any Javascript code listening for the DOMContentLoaded event. -
setOnloadTime
How long it takes the browser to execute Javascript code waiting for the window.load event. -
setEventCategory
eg. Videos, Music, Games... -
setEventAction
An event action like Play, Pause, Duration, Add Playlist, Downloaded, Clicked... -
setEventName
The event name for example a Movie name, or Song name, or File name... -
setEventValue
Some numeric value that represents the event value. -
setContentName
The name of the content. For instance 'Ad Foo Bar' -
setContentPiece
The actual content piece. For instance the path to an image, video, audio, any text -
setContentTarget
The target of the content. For instance the URL of a landing page -
setContentInteraction
The name of the interaction with the content. For instance a 'click' -
setEcommerceId
he unique string identifier for the ecommerce order (required when tracking an ecommerce order). you must set &idgoal=0 in the request to track an ecommerce interaction: cart update or an ecommerce order. -
setEcommerceItems
Items in the Ecommerce order. -
setEcommerceSubtotal
The subtotal of the order; excludes shipping. -
setEcommerceTax
Tax amount of the order. -
setEcommerceShippingCost
Shipping cost of the order. -
setEcommerceDiscount
Discount offered. -
setEcommerceLastOrderTimestamp
The UNIX timestamp of this customer's last ecommerce order. This value is used to process the "Days since last order" report. -
setAuthToken
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
Override value for the visitor IP (both IPv4 and IPv6 notations supported). -
setRequestTimestamp
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
An override value for the country. Must be a two-letter ISO 3166 Alpha-2 country code. -
setVisitorRegion
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
An override value for the city. The name of the city the visitor is located in, eg, Tokyo. -
setVisitorLatitude
An override value for the visitor's latitude, eg 22.456. -
setVisitorLongitude
An override value for the visitor's longitude, eg 22.456. -
setQueuedTracking
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
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.0Default is
false
-
setPing
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
By default, Matomo does not track bots. If you use the Tracking HTTP API directly, you may be interested in tracking bot requests. -
setRandomValue
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
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. -
setCrashMessage
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
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
Category of a crash to group crashes by.Custom action must be enabled for this.
Optional for crash analytics
-
setCrashStackTrace
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
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
The line number of the crash source, where the crash occurred.Custom action must be enabled for this.
Optional for crash analytics
-
setCrashColumn
The column within the line where the crash occurred.Optional for crash analytics
-
setSessionId
The Matomo session ID sent as a cookieMATOMO_SESSID
.If not null a cookie with the name
MATOMO_SESSID
will be sent with the value of this parameter. -
setDimensions
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
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
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
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
-
request()