Skip to content

Commit

Permalink
Improve variable naming and code comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
ConfidantCommunications committed Feb 5, 2022
1 parent f82a17d commit 76f3983
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/ca/confidant/glory/controller/UpdatePushStateCommand.hx
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ package ca.confidant.glory.controller;
&& (data.newPage!=data.oldPage)
&& (data.updatePushState == true)
){
var url = pcp.getBasePath()+data.newPage;
var trackerPath = pcp.getBasePath()+data.newPage;
var t = pcp.getAppTitle() + " : "+ newPage.get("title");
eim.updatePushState(url);
eim.updatePushState(trackerPath);
eim.updateDocumentTitle(t);

//now track the homepage as the root URL
if (data.newPage == pcp.getHomepageId()){
url = pcp.getBasePath();
trackerPath = pcp.getBasePath();
}

#if (enableGoogleTrackerV3 || enableGoogleTrackerV4)
var tp:TrackerProxy = cast(facade.retrieveProxy("google"));
tp.trackPageview(url,t);
tp.trackPageview(trackerPath,t);
#end
}

Expand Down
11 changes: 7 additions & 4 deletions src/ca/confidant/glory/model/TrackerProxy.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
class TrackerProxy extends Proxy
{

private var homePath:String;
public function new( name:String )
{
super ( name );
Expand Down Expand Up @@ -60,13 +60,16 @@
public function init(id:String, domain:String, version:String = "", locale:String = "C"):Void{
//https://developers.google.com/analytics/devguides/collection/analyticsjs/accessing-trackers
trace("starting google");
this.homePath = "https://"+domain+"/";
Syntax.code("ga('create', {0}, 'auto')", id);
}
public function trackPageview(pageId:String, pageTitle:String){
public function trackPageview(trackerPath:String, pageTitle:String){
//https://developers.google.com/analytics/devguides/collection/analyticsjs/pages
//https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications
trace("tracking google");
var params = {page:pageId,title:pageTitle};
var params = {page:trackerPath,title:pageTitle};
Syntax.code("ga('set', {0})", params);
Syntax.code("ga('send', 'pageview')");
Syntax.code("ga('send', 'pageview')"); //no need for 3rd parameter (page) because we set it in the line above
}

#end
Expand Down

0 comments on commit 76f3983

Please sign in to comment.