Skip to content

Commit

Permalink
Merge pull request #52 from pierreavizou/issue-49-ga
Browse files Browse the repository at this point in the history
Addresses issue #49: sets updated page data on GA tracker
  • Loading branch information
sayan-rudder authored May 1, 2020
2 parents 4d7905d + 61101b9 commit 9684e73
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions integrations/GA/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,28 @@ class GA {
page(rudderElement) {
logger.debug("in GoogleAnalyticsManager page");
var path =
rudderElement.properties && rudderElement.properties.path
? rudderElement.properties.path
rudderElement.message.properties && rudderElement.message.properties.path
? rudderElement.message.properties.path
: undefined;
var title = rudderElement.message.properties && rudderElement.message.properties.title
? rudderElement.message.properties.title
: undefined;
var location = rudderElement.message.properties && rudderElement.message.properties.url
? rudderElement.message.properties.url
: undefined;

if (path) {
ga("set", "page", path);
}

if (title) {
ga("set", "title", title);
}

if (location) {
ga("set", "location", location);
}

ga("send", "pageview");
}

Expand Down

0 comments on commit 9684e73

Please sign in to comment.