public GoogleAnalytics(GoogleAnalyticsConfig config, String trackingId, String appName, String appVersion) { this(config, new DefaultRequest().trackingId(trackingId).applicationName(appName).applicationVersion(appVersion)); }
public Boolean exceptionFatal() { return getBoolean(EXCEPTION_FATAL); }
public Double txTax() { return getDouble(TRANSACTION_TAX); } }
public GoogleAnalytics(GoogleAnalyticsConfig config, String trackingId) { this(config, new DefaultRequest().trackingId(trackingId)); }
public DefaultRequest(String hitType, String trackingId, String appName, String appVersion) { String cId; hitType(isEmpty(hitType) ? "pageview" : hitType); trackingId(trackingId); applicationName(appName); applicationVersion(appVersion); try { // Use MAC addr and user id to hash into a UUID cId = UUID.nameUUIDFromBytes((InetAddress.getLocalHost().getHostAddress().toString()+System.getProperty("user.name")).getBytes()).toString(); } catch (UnknownHostException e) { cId = UUID.nameUUIDFromBytes(System.getProperty("user.name").getBytes()).toString(); } clientId(cId); }
public GoogleAnalyticsServiceImpl() { super(new GoogleAnalyticsConfig(), new DefaultRequest()); }
@PostConstruct private void setup(){ this.getDefaultRequest().trackingId(getGoogleAnalyticsSiteId()); /*this.setDefaultRequest(new DefaultRequest().trackingId(getGoogleAnalyticsSiteId)); this(new GoogleAnalyticsConfig(), new DefaultRequest().trackingId(trackingId));*/ }
@Override public DefaultRequest discoverParameters(GoogleAnalyticsConfig config, DefaultRequest request) { try { if (isEmpty(config.getUserAgent())) { config.setUserAgent(getUserAgentString()); } if (isEmpty(request.userLanguage())) { String region = System.getProperty("user.region"); if (isEmpty(region)) { region = System.getProperty("user.country"); } request.userLanguage(System.getProperty("user.language") + "-" + region); } if (isEmpty(request.documentEncoding())) { request.documentEncoding(System.getProperty("file.encoding")); } } catch (Exception e) { // logger.warn("Exception while deriving the System properties for request " + request, e); } return request; }
/** * Processes the custom dimensions and adds the values to list of parameters, which would be posted to GA. * * @param request * @param postParms */ private void processCustomDimensionParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) { Map<String, String> customDimParms = new HashMap<String, String>(); for (String defaultCustomDimKey : defaultRequest.customDimensions().keySet()) { customDimParms.put(defaultCustomDimKey, defaultRequest.customDimensions().get(defaultCustomDimKey)); } @SuppressWarnings("unchecked") Map<String, String> requestCustomDims = request.customDimensions(); for (String requestCustomDimKey : requestCustomDims.keySet()) { customDimParms.put(requestCustomDimKey, requestCustomDims.get(requestCustomDimKey)); } for (String key : customDimParms.keySet()) { postParms.add(new BasicNameValuePair(key, customDimParms.get(key))); } }
/** * Processes the custom metrics and adds the values to list of parameters, which would be posted to GA. * * @param request * @param postParms */ private void processCustomMetricParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) { Map<String, String> customMetricParms = new HashMap<String, String>(); for (String defaultCustomMetricKey : defaultRequest.custommMetrics().keySet()) { customMetricParms.put(defaultCustomMetricKey, defaultRequest.custommMetrics().get(defaultCustomMetricKey)); } @SuppressWarnings("unchecked") Map<String, String> requestCustomMetrics = request.custommMetrics(); for (String requestCustomDimKey : requestCustomMetrics.keySet()) { customMetricParms.put(requestCustomDimKey, requestCustomMetrics.get(requestCustomDimKey)); } for (String key : customMetricParms.keySet()) { postParms.add(new BasicNameValuePair(key, customMetricParms.get(key))); } }
public GoogleAnalytics(String trackingId) { this(new GoogleAnalyticsConfig(), new DefaultRequest().trackingId(trackingId)); }
public Double txShipping() { return getDouble(TRANSACTION_SHIPPING); }
public Double itemPrice() { return getDouble(ITEM_PRICE); }
public Double txRevenue() { return getDouble(TRANSACTION_REVENUE); }