johan855
johan855

Reputation: 1626

What does the "+e+" mean in this Javascript?

Can someone give me a hand and tell me what does this "+e+" do in the following script (taken from

https://tracking.crealytics.com/lib/multi_conversion.min.js

)? I highlighted it in black:

(function(){var t,e,n;this.__multi_conversion_tracking=function(e,n){var i,c,r;return i=document.getElementsByTagName("body")[0],c=document.createElement("div"),c.id="multi_conversion_tracking",c.style.display="none",r=document.createElement("iframe"),r.src=t(e,n,1),c.appendChild(r),i.appendChild(c)},n=function(){return"https:"===location.protocol.toLowerCase()?"https":"http"},t=function(t,e,i){return null==i&&(i=1),""+n()+"://tracking.crealytics.com/"+t+"/multi_check.php ?data="+e+" &random="+(new Date).getTime()+" &frame="+i},e=function(t,e){return-1!==t.indexOf(e,t.length-e.length)}}).call(this);

I am trying to figure out why this script is not parsing correctly the following tag:

 <script
 src="https://tracking.crealytics.com/lib/multi_conversion.min.js"></script>
 <script type="text/javascript"> var transactionString =
 {{CrealyticsProductsInfo}};__multi_conversion_tracking(70,
 "transactionString"); </script> <noscript> <div style="display:inline;"> <img
 src="https://tracking.crealytics.com/70/multi_check.php?data=transactionString">
 </div> </noscript>

this is the assignation I give the variable in my tracking code:

     var divElement = document.createElement("Div"); 
     divElement.id = "transactionString"; 
     divElement.setAttribute('data-transaction-string', products_info);

It is supposed to mimic the following div element:

<div id='transactionString' data-transaction-string='DATA'></div>

Upvotes: 1

Views: 962

Answers (4)

xakdog
xakdog

Reputation: 695

e it's just argument of function t. It concatenating e argument with another parts of url.

__multi_conversion_tracking call t function r.src = t(e, n, 1)

(function() {
    var t, e, n;
    this.__multi_conversion_tracking = function(e, n) {
        var i, c, r;
        return i = document.getElementsByTagName("body")[0],
               c = document.createElement("div"),
               c.id = "multi_conversion_tracking",
               c.style.display = "none",
               r = document.createElement("iframe"),
               r.src = t(e, n, 1),
               c.appendChild(r),
               i.appendChild(c)
    }, n = function() {
        return "https:" === location.protocol.toLowerCase() ? "https" : "http"
    }, t = function(t, e, i) {
        return null == i && (i = 1), "" + n() + "://tracking.crealytics.com/" + t + "/multi_check.php ?data=" + e + " &random=" + (new Date).getTime() + " &frame=" + i
    }, e = function(t, e) {
        return -1 !== t.indexOf(e, t.length - e.length)
    }
}).call(this)

Upvotes: 1

baao
baao

Reputation: 73231

You concat a string with a variable, or multiple variables, with this.

For example

var e = "johan855";
var string = "Hello " + e + ".";
console.log(string);

And / or

var e = "johan855";
var a = "Hello ";
var dot = ".";
var string = a + e + dot;
console.log(string);

will output

Hello johan855.

Upvotes: 1

Phil Maddaloni
Phil Maddaloni

Reputation: 81

multi_conversion_tracking function takes two parameters, e and n. the value of the first parameter (e) will be appended to the data parameter in that query string being composed using + e +

Upvotes: 3

Damien
Damien

Reputation: 3362

The "+e+" part in this javascript code is just a concatenation of the var e with other elements to create a string.

Upvotes: 0

Related Questions