JSFiddle - React, Tailwind, and code Playground

by Oliver Kelso

JavaScript

var data = {
    "test":"true",
    "user" : "Oliver Kelso",
    "id" : "1",
    "city" : "Portland",
};

function pulseHit(obj){
    var string = "",
        d;
    
    function encode(s){
        if (typeof encodeURIComponent == "function") {
            return encodeURIComponent(s);
        } else {
            return escape(s);
        }   
    };
    
    for (var key in obj) {
        if (obj.hasOwnProperty(key)) {
            string += key + "=" + encode(obj[key]) + "&";         
        }
    }
    
    if (!Date.now) {
        Date.now = function now(d) {
            d = new Date().getTime();
        };
    } else {
        d = Date.now();
    }
    
    string += "pset=" + d;
    string = string.replace(/&+$/, "");
    return string;
    //Bootstrapper.imageRequest('//hp.activate.ensighten.com/no-content?' + string);
};

console.log(pulseHit(data));