-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Add GA node code( initial commit )
2. publish cjs to npm 3. Add a test to download rudder-sdk-node module from npm and use it to send data to BE and GA. 4. Other refactoring.
- Loading branch information
1 parent
eb9f3e4
commit e3fb321
Showing
16 changed files
with
4,046 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,563 changes: 1,562 additions & 1 deletion
1,563
rudder-client-javascript/analytics/dist/browser.js
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
rudder-client-javascript/analytics/integrations/GA/browser.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class GA { | ||
constructor() { | ||
console.log("nothing to construct"); | ||
} | ||
|
||
init() { | ||
console.log("browser not implemented"); | ||
|
||
console.log("===in init==="); | ||
} | ||
|
||
identify(rudderElement) { | ||
console.log("browser not implemented"); | ||
} | ||
|
||
track(rudderElement) { | ||
console.log("browser not implemented"); | ||
} | ||
|
||
page(rudderElement) { | ||
console.log("browser not implemented"); | ||
} | ||
|
||
loaded() { | ||
console.log("in GA isLoaded"); | ||
console.log("browser not implemented"); | ||
} | ||
} | ||
|
||
export { GA }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { GANode } from "./node"; | ||
import { GA } from "./browser"; | ||
|
||
export default process.browser ? GA : GANode; |
58 changes: 58 additions & 0 deletions
58
rudder-client-javascript/analytics/integrations/GA/node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import ua from "universal-analytics"; | ||
|
||
class GANode { | ||
constructor(trackingID) { | ||
this.trackingID = trackingID; | ||
this.client = ""; | ||
} | ||
|
||
init() { | ||
console.log("===in GA Node init==="); | ||
|
||
//this.client = ua(this.trackingID, "6a14abda-6b12-4578-bf66-43c754eaeda9"); | ||
} | ||
|
||
identify(rudderElement) { | ||
console.log("=== in GA Node identify==="); | ||
this.client = ua(this.trackingID, rudderElement.message.user_id); | ||
} | ||
|
||
track(rudderElement) { | ||
console.log("=== in GA Node track==="); | ||
this.client.event( | ||
rudderElement.message.type, | ||
rudderElement.message.event, | ||
function(err) { | ||
// Handle the error if necessary. | ||
// In case no error is provided you can be sure | ||
// the request was successfully sent off to Google. | ||
console.log("error sending to GA" + err); | ||
} | ||
); | ||
} | ||
|
||
page(rudderElement) { | ||
console.log("=== in GA Node page==="); | ||
if ( | ||
rudderElement.message.properties && | ||
rudderElement.message.properties.path | ||
) { | ||
this.client.pageview(rudderElement.message.properties.path, function( | ||
err | ||
) { | ||
// Handle the error if necessary. | ||
// In case no error is provided you can be sure | ||
// the request was successfully sent off to Google. | ||
console.log("error sending to GA" + err); | ||
}); | ||
//this.client.pageview(rudderElement.message.properties.path).send(); | ||
} | ||
} | ||
|
||
loaded() { | ||
console.log("in GA isLoaded"); | ||
console.log("node not supported"); | ||
} | ||
} | ||
|
||
export { GANode }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import * as HubSpot from "./HubSpot"; | ||
import * as GA from "./GA"; | ||
|
||
let integrations = { HS: HubSpot.default }; | ||
let integrations = { HS: HubSpot.default, GA: GA.default }; | ||
|
||
export { integrations }; |
Oops, something went wrong.