ClickDimensions: Embedding Subscription Preference Page in existing website / portal – in time for GDPR!

The Click Dimensions subscription preferences page is very good if you use it as a standalone page where the contact would have to type in their email address and set their preferences.

However I have had a recent requirement to embed this page into my clients existing portal/website in which the user would of already authenticated themselves and asking them to retype in their email would simply not be a great experience.

The subscription preference page allows for JavaScript to be added to the form, so therefore the following script was added to the onLoad event to allow for the page to accept a email parameter, populate the email text with the value and hide the text box entirely.

This then allows the page to be handled via the portal.
Note: this workaround has not been validated by Click Dimensions and therefore you use this at your own risk.
The JavaScript code is below.

function getAllUrlParams(url) {

// get query string from url (optional) or window
var queryString = url ? url.split(‘?’)[1] :;

// we’ll store the parameters here
var obj = {};

// if query string exists
if (queryString) {

// stuff after # is not part of query string, so get rid of it
queryString = queryString.split(‘#’)[0];

// split our query string into its component parts
var arr = queryString.split(‘&’);

for (var i=0; i<arr.length; i++) {
// separate the keys and the values
var a = arr[i].split(‘=’);

// in case params look like: list[]=thing1&list[]=thing2
var paramNum = undefined;
var paramName = a[0].replace(/\[\d*\]/, function(v) {
paramNum = v.slice(1,-1);
return ”;

// set parameter value (use ‘true’ if empty)
var paramValue = typeof(a[1])===’undefined’ ? true : a[1];

// (optional) keep case consistent
paramName = paramName.toLowerCase();
paramValue = paramValue.toLowerCase();

// if parameter name already exists
if (obj[paramName]) {
// convert value to array (if still string)
if (typeof obj[paramName] === ‘string’) {
obj[paramName] = [obj[paramName]];
// if no array index number specified…
if (typeof paramNum === ‘undefined’) {
// put the value on the end of the array
// if array index number specified…
else {
// put the value at that index number
obj[paramName][paramNum] = paramValue;
// if param name doesn’t exist yet, set it
else {
obj[paramName] = paramValue;

return obj;

//This function executes the function above and set the values in the fields
window.onload=function execParm()
var urlemail = getAllUrlParams().email;
var EmailField = document.getElementById(“f_4bfb293a11a3f759a081e2a890d00085″);”none”;
EmailField.value = urlemail;


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.