Skip to content

Commit

Permalink
Code formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Nov 14, 2021
1 parent e48048e commit 5e585b1
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -1052,38 +1052,38 @@ function processDataInAnalyticsArray(analytics) {
instance.toBeProcessedArray = [];
}

/**
* parse the given query string into usable Rudder object
* @param {*} query
*/
/**
* parse the given query string into usable Rudder object
* @param {*} query
*/
function parseQueryString(query) {
const queryDefaults = {
trait: "ajs_trait_",
prop: "ajs_prop_",
};

function getDataFromQueryObj(qObj, dataType) {
const data = {};
Object.keys(qObj).forEach((key) => {
if (key.startsWith(dataType)) {
data[key.substr(dataType.length)] = qObj[key];
}
});
return data;
}
const queryDefaults = {
trait: "ajs_trait_",
prop: "ajs_prop_",
};

function getDataFromQueryObj(qObj, dataType) {
const data = {};
Object.keys(qObj).forEach((key) => {
if (key.startsWith(dataType)) {
data[key.substr(dataType.length)] = qObj[key];
}
});
return data;
}

const queryObject = parse(query);
if (queryObject.ajs_aid) {
const queryObject = parse(query);
if (queryObject.ajs_aid) {
instance.toBeProcessedArray.push(["setAnonymousId", queryObject.ajs_aid]);
}
}

if (queryObject.ajs_uid) {
instance.toBeProcessedArray.push([
"identify",
queryObject.ajs_uid,
getDataFromQueryObj(queryObject, queryDefaults.trait),
]);
}
}

if (queryObject.ajs_event) {
instance.toBeProcessedArray.push([
Expand Down Expand Up @@ -1117,9 +1117,9 @@ const argumentsArray = window.rudderanalytics || [];
while (argumentsArray.length > 0) {
if (argumentsArray[0][0] === defaultMethod) {
instance.toBeProcessedArray.push(argumentsArray[0]);
argumentsArray.shift();
argumentsArray.shift();
break;
}
}
argumentsArray.shift();
}

Expand Down

0 comments on commit 5e585b1

Please sign in to comment.