package codeOrchestra.colt.core.tracker;

import com.dmurph.tracking.AnalyticsConfigData;
import com.dmurph.tracking.JGoogleAnalyticsTracker;
import com.dmurph.tracking.VisitorData;
import com.dmurph.tracking.system.AWTSystemPopulator;

/**
 * @author Dima Kruk
 */
public class GATracker {
    private static GATracker ourInstance = new GATracker();

    private JGoogleAnalyticsTracker tracker;

    public static GATracker getInstance() {
        return ourInstance;
    }

    private GATracker() {
        JGoogleAnalyticsTracker.setProxy(System.getenv("http_proxy"));
        int UUID = 1;//TODO: make unique ID
        VisitorData visitorData = VisitorData.newVisitor(UUID);
        //TODO: replace with production TrackingCode
        AnalyticsConfigData config = new AnalyticsConfigData("UA-42969501-3", visitorData);
        AWTSystemPopulator.populateConfigData(config);

        tracker = new JGoogleAnalyticsTracker(config, JGoogleAnalyticsTracker.GoogleAnalyticsVersion.V_4_7_2);
    }

    public JGoogleAnalyticsTracker getTracker() {
        return tracker;
    }
}

@@ -391,16 +391,103 @@
 acker;%0A%0A
+    private String hostName = %22codeorchestra.com%22;%0A    private String refPage = %22/%22;%0A%0A%0A
     publ
@@ -1096,69 +1096,321 @@
 lic 
-JGoogleAnalyticsTracker getTracker() %7B%0A        return tracker
+void trackEvent(String argCategory, String argAction) %7B%0A        tracker.trackEvent(argCategory, argAction);%0A    %7D%0A%0A    public void trackPageView(String argPageURL, String argPageTitle) %7B%0A        tracker.trackPageViewFromReferrer(argPageURL, argPageTitle, hostName, hostName, refPage);%0A        refPage = argPageURL
 ;%0A  

change logic for GA