- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
03-15-2018 09:37 AM
We have some code where we loop through several parameter/value combination to set them into the utag_main cookie.
E.g.:
var dynamicpar = "parameter_name_for_this_loop"; utag.loader.SC("utag_main", { [dynamicpar]: "somevalue" });
This sets utag_main parameter to "parameter_name_for_this_loop":"somevalue". It works in most browsers, but not in IE11...
How can we set the name of a parameter in the utag_main cookie dynamically for all browsers? Is it possible at all?
Solved! Go to Solution.
03-15-2018 09:56 AM
Computed keys are a feature of ES6 and are not available in older JS implementations.
The easiest way to get it to just work would be:
var dynamicpar = "parameter_name_for_this_loop"; var cookie_payload = {}; cookie_payload[dynamicpar] = "somevalue"; utag.loader.SC("utag_main", cookie_payload);
Wherein you initialise an empty object, and then set the dynamic key to the desired value using the traditional mehod.
03-15-2018 11:05 AM
03-15-2018 05:16 PM
I'd say @loldenburg that @UnknownJ deserves to have his post "Accepted as a Solution" #winkwink
03-15-2018 11:10 PM
03-16-2018 11:02 AM
Yay @loldenburg! #hugs
Copyright All Rights Reserved © 2008-2023