Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 committed Aug 3, 2021
1 parent 12691dc commit 709234d
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
59 changes: 59 additions & 0 deletions integrations/Qualtrics/browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* eslint-disable no-unused-expressions */

import logger from "../../utils/logUtil";

class Qualtrics {
constructor(config) {
this.name = "Qualtrics";
this.projectId = config.projectId;
this.brandId = config.brandId;
}

init() {
logger.debug("===in init Qualtrics===");
var div;
if (!this.projectId) {
logger.debug("Project ID missing");
return;
}

if (!this.brandId) {
logger.debug("Brand ID missing");
return;
}

(function () {
var g = function (e, h, f, g) {
this.get = function (a) { for (var a = a + "=", c = document.cookie.split(";"), b = 0, e = c.length; b < e; b++) { for (var d = c[b]; " " == d.charAt(0);)d = d.substring(1, d.length); if (0 == d.indexOf(a)) return d.substring(a.length, d.length) } return null };
this.set = function (a, c) { var b = "", b = new Date; b.setTime(b.getTime() + 6048E5); b = "; expires=" + b.toGMTString(); document.cookie = a + "=" + c + b + "; path=/; " };
this.check = function () { var a = this.get(f); if (a) a = a.split(":"); else if (100 != e) "v" == h && (e = Math.random() >= e / 100 ? 0 : 100), a = [h, e, 0], this.set(f, a.join(":")); else return !0; var c = a[1]; if (100 == c) return !0; switch (a[0]) { case "v": return !1; case "r": return c = a[2] % Math.floor(100 / c), a[2]++, this.set(f, a.join(":")), !c }return !0 };
this.go = function () { if (this.check()) { var a = document.createElement("script"); a.type = "text/javascript"; a.src = g; document.body && document.body.appendChild(a) } };
this.start = function () { var t = this; "complete" !== document.readyState ? window.addEventListener ? window.addEventListener("load", function () { t.go() }, !1) : window.attachEvent && window.attachEvent("onload", function () { t.go() }) : t.go() };
};
try { (new g(100, "r", this.projectId, `https://znblw72o0twxcqlbg-${this.brandId}.siteintercept.qualtrics.com/SIE/?Q_ZID=${this.projectId}`)).start() } catch (i) { }
})();
div = document.createElement('div');
div.setAttribute("id", this.projectId);
window._qsie = window._qsie || [];

}

// eslint-disable-next-line class-methods-use-this
isLoaded() {
logger.debug("===in Qualtrics isLoaded===");
return !!(window.window._qsie && window._qsie.push !== Array.prototype.push);
}

// eslint-disable-next-line class-methods-use-this
isReady() {
logger.debug("===in Qualtrics isReady===");
return !!(window._qsie &&window._qsie.push !== Array.prototype.push);
}

track(rudderElement) {
const {message} = rudderElement;
window._qsie.push(message.event);

}
}
export default Qualtrics;
3 changes: 3 additions & 0 deletions integrations/Qualtrics/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Qualtrics from "./browser";

export default Qualtrics;
1 change: 1 addition & 0 deletions integrations/client_server_name.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const clientToServerNames = {
HEAP: "Heap.io",
CRITEO: "Criteo",
MP: "Mixpanel",
QUALTRICS: "Qualtrics",
};

export { clientToServerNames };
2 changes: 2 additions & 0 deletions integrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import * as RedditPixel from "./RedditPixel";
import * as Heap from "./Heap";
import * as Criteo from "./Criteo";
import * as Mixpanel from "./Mixpanel";
import * as Qualtrics from "./Qualtrics";

// the key names should match the destination.name value to keep partity everywhere
// (config-plan name, native destination.name , exported integration name(this one below))
Expand Down Expand Up @@ -75,6 +76,7 @@ const integrations = {
HEAP: Heap.default,
CRITEO: Criteo.default,
MP: Mixpanel.default,
QUALTRICS: Qualtrics.default,
};

export { integrations };
3 changes: 3 additions & 0 deletions integrations/integration_cname.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ const commonNames = {
CRITEO: "CRITEO",
MIXPANEL: "MP",
Mixpanel: "MP",
Qualtrics: "QUALTRICS",
qualtrics: "QUALTRICS",
QUALTRICS: "QUALTRICS",
};

export { commonNames };

0 comments on commit 709234d

Please sign in to comment.