ENABLED = b;
}
+ public void sendAnalytics(String eventName, String... paramsStrings)
+ {
+ sendAnalytics(eventName, false, paramsStrings);
+ }
+
/**
* The simplest way to send an analytic event.
*
* The event name. To emulate a webpage view use "page_view" and set
* a "page_location" parameter. See
* https://developers.google.com/analytics/devguides/collection/ga4/events?client_type=gtag
+ * @param sendDefaultParams
+ * Flag whether to add the default params about the application.
* @param paramsStrings
* Optional multiple Strings in key, value pairs (there should be an
* even number of paramsStrings) to be set as parameters of the
* event. To emulate a webpage view use "page_location" as the URL in
* a "page_view" event.
*/
- public void sendAnalytics(String eventName, String... paramsStrings)
+ public void sendAnalytics(String eventName, boolean sendDefaultParams,
+ String... paramsStrings)
{
// clear out old lists
this.resetLists();
Map<String, String> params = new HashMap<>();
// add these to all events from this application instance
- params.putAll(defaultParams);
+ if (sendDefaultParams)
+ {
+ params.putAll(defaultParams);
+ }
// add (and overwrite with) the passed in params
if (paramsStrings != null && paramsStrings.length > 0)
// This will send a new "application_launch" event with parameters
// including the old-style "path", the channel name and version
- ga4.sendAnalytics("application_launch", "page_location", path);
+ ga4.sendAnalytics("application_launch", true, "page_location", path);
}
else
{