InvocaJS Toolkit Library¶
Note: Any method preceded with an underscore is subject to change and should not be used.
"invoca_session" cookie for a cached value. If the request is not found, it returns the default value or null if one is not passed.
"key" is the name of the parameter to search for.
"defaultValue" is the value returned if “key” is not found.
This function uses a
campaignMapping hash to search the referrer for each key in the hash and will return its value as a campaign ID. If none are found, it will return the default value.
"campaignMapping" is a hash of strings to look for in the referrer. The key is what to look for, the value is the corresponding Campaign ID.
"defaultValue" is a string of the fallback Campaign ID that should be returned when no keys are found.
This function will search for a string inside another string. It will return true if it does and false if it does not.
"haystack" is the string to look in.
"needle" is the string to look for.
Looking for a needle in a haystack!
This function will search all query strings the the URL for a key name and return it’s value.
"key" = Name of the query string parameter to look for.
This function will attempt to return the device type of the visitor.
This function will decide if the visitor is on a mobile device.
true when visitor is on a mobile phone or tablet.
false when visitor is on desktop or unknown.
This function will wait for a function to return a value before executing the next code.
Invoca.Tools.waitFor(inputFunction, callbackFunction, defaultValue, maxWaitTime)
inputFuction must be a function, any value returned by this function will be considered true, so return null to try again.
callbackFunction must be a function, and is called with the found value or default value passed as an argument.
defaultVaule is the value that will be passed into
inputFunction fails to return a value within the
maxWaitTime is the maximum amount of miliseconds to wait for
inputFunction to return a value.