Skip to content

Commit

Permalink
updated version and output files
Browse files Browse the repository at this point in the history
  • Loading branch information
prabrisha-rudder committed Oct 31, 2019
1 parent 06686b4 commit 29f8d38
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Few sample usage of the sdk can be found under **tests** directory for vanilla h
}
analytics.load("YOUR_WRITE_KEY", "DATA_PLANE_URI");
</script>
<script src="https://unpkg.com/[email protected].0"></script>
<script src="https://unpkg.com/[email protected].3"></script>
// The above is basically the browser.min.js being serviced by cdn, for localtesting, one can refer the js under dist folder
// This marks the end of loading our script, one can wrap the above in iife if it helps
Expand Down
2 changes: 1 addition & 1 deletion rudder-client-javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Few sample usage of the sdk can be found under **tests** directory for vanilla h
analytics.load("YOUR_WRITE_KEY", "DATA_PLANE_URI");
//analytics.load("1S2kNlbkMrWLBO79H2eNuEST27I", "http://localhost:9090");
</script>
<script src="https://unpkg.com/[email protected].0"></script>
<script src="https://unpkg.com/[email protected].3"></script>
//The above is basically the browser.min.js being serviced by cdn, for local
testing, one can refer the js under dist folder
Expand Down
3 changes: 1 addition & 2 deletions rudder-client-javascript/analytics/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ class Analytics {

if (!intgArray || intgArray.length == 0) {
this.toBeProcessedByIntegrationArray = [];
intgInstance.init();
return;
}
intgArray.forEach(intg => {
Expand All @@ -124,7 +123,7 @@ class Analytics {
//this.clientIntegrationObjects.push(intgInstance);
this.isInitialized(intgInstance).then(this.replayEvents);
}
if (intg === "HJ") {
if (intg === "HOTJAR") {
let siteID = configArray[i].siteID;
let intgInstance = new intgClass(siteID);
intgInstance.init();
Expand Down
75 changes: 74 additions & 1 deletion rudder-client-javascript/analytics/dist/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,71 @@ var analytics = (function (exports) {

var index$1 = GA ;

var Hotjar =
/*#__PURE__*/
function () {
function Hotjar(siteId) {
_classCallCheck(this, Hotjar);

this.siteId = siteId; //1549611

this.name = "HOTJAR";
}

_createClass(Hotjar, [{
key: "init",
value: function init() {
window.hotjarSiteId = this.siteId;

(function (h, o, t, j, a, r) {
h.hj = h.hj || function () {
(h.hj.q = h.hj.q || []).push(arguments);
};

h._hjSettings = {
hjid: h.hotjarSiteId,
hjsv: 6
};
a = o.getElementsByTagName('head')[0];
r = o.createElement('script');
r.async = 1;
r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
a.appendChild(r);
})(window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv=');

console.log("===in init Hotjar===");
}
}, {
key: "identify",
value: function identify(rudderElement) {
console.log("method not supported");
}
}, {
key: "track",
value: function track(rudderElement) {
console.log("method not supported");
}
}, {
key: "page",
value: function page(rudderElement) {
console.log("method not supported");
}
}, {
key: "isLoaded",
value: function isLoaded() {
console.log("method not supported");
}
}]);

return Hotjar;
}();

var index$2 = Hotjar ;

var integrations = {
HS: index,
GA: index$1
GA: index$1,
HOTJAR: index$2
};

//Application class
Expand Down Expand Up @@ -1240,6 +1302,17 @@ var analytics = (function (exports) {

_this.isInitialized(_intgInstance).then(_this.replayEvents);
}

if (intg === "HOTJAR") {
var siteID = configArray[i].siteID;

var _intgInstance2 = new intgClass(siteID);

_intgInstance2.init();
/* As we Hotjar tracks all events by itself, no need to send events explicitly.
So, not putting 'Hotjar' object in clientIntegrationObjects list. */

}
});
}
}, {
Expand Down
2 changes: 1 addition & 1 deletion rudder-client-javascript/analytics/dist/browser.min.js

Large diffs are not rendered by default.

57 changes: 56 additions & 1 deletion rudder-client-javascript/analytics/dist/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,53 @@ function () {

var index$1 = GANode;

var HotjarNode =
/*#__PURE__*/
function () {
function HotjarNode() {
_classCallCheck(this, HotjarNode);

console.log("nothing to construct");
}

_createClass(HotjarNode, [{
key: "init",
value: function init() {
console.log("node not supported");
console.log("===in init===");
}
}, {
key: "identify",
value: function identify(rudderElement) {
console.log("node not supported");
}
}, {
key: "track",
value: function track(rudderElement) {
console.log("node not supported");
}
}, {
key: "page",
value: function page(rudderElement) {
console.log("node not supported");
}
}, {
key: "loaded",
value: function loaded() {
console.log("in hubspot isLoaded");
console.log("node not supported");
}
}]);

return HotjarNode;
}();

var index$2 = HotjarNode;

var integrations = {
HS: index,
GA: index$1
GA: index$1,
HOTJAR: index$2
};

//Application class
Expand Down Expand Up @@ -1133,6 +1177,17 @@ function () {

_this.isInitialized(_intgInstance).then(_this.replayEvents);
}

if (intg === "HOTJAR") {
var siteID = configArray[i].siteID;

var _intgInstance2 = new intgClass(siteID);

_intgInstance2.init();
/* As we Hotjar tracks all events by itself, no need to send events explicitly.
So, not putting 'Hotjar' object in clientIntegrationObjects list. */

}
});
}
}, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Hotjar {
constructor(siteId) {
this.siteId = siteId;//1549611
this.name = "HJ";
this.name = "HOTJAR";
}

init() {
Expand Down
2 changes: 1 addition & 1 deletion rudder-client-javascript/analytics/integrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import * as HubSpot from "./HubSpot";
import * as GA from "./GA";
import * as Hotjar from "./Hotjar";

let integrations = { HS: HubSpot.default, GA: GA.default, HJ: Hotjar.default };
let integrations = { HS: HubSpot.default, GA: GA.default, HOTJAR: Hotjar.default };

export { integrations };
2 changes: 1 addition & 1 deletion rudder-client-javascript/analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-analytics",
"version": "1.0.0",
"version": "1.0.3",
"description": "",
"main": "./dist/browser.min.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1>Page Loaded</h1>

analytics.load("1S2kNlbkMrWLBO79H2eNuEST27I", "https://torpedo.dev.rudderlabs.com/v1/batch");
</script>
<script src="https://unpkg.com/[email protected].0"></script>
<script src="https://unpkg.com/[email protected].3"></script>

<script type="text/javascript">
analytics.identify(
Expand Down

0 comments on commit 29f8d38

Please sign in to comment.