FxaForm.getAttributionData = function()

in media/js/base/fxa-form.es6.js [61:100]


FxaForm.getAttributionData = function (params) {
    const allowedChars = /^[\w/.%-]+$/;
    const finalParams = {};

    for (let i = 0; i < acceptedParams.length; i++) {
        const acceptedParam = acceptedParams[i];
        if (Object.prototype.hasOwnProperty.call(params, acceptedParam)) {
            try {
                const foundParam = decodeURIComponent(params[acceptedParam]);
                if (allowedChars.test(foundParam)) {
                    finalParams[acceptedParam] = foundParam;
                }
            } catch (e) {
                // silently drop malformed parameter values (issue #10897)
            }
        }
    }

    // Both utm_source and utm_campaign are considered required, so only pass through referral data if they exist.
    // Alternatively, pass through entrypoint_experiment and entrypoint_variation independently.
    if (
        (Object.prototype.hasOwnProperty.call(finalParams, 'utm_source') &&
            Object.prototype.hasOwnProperty.call(
                finalParams,
                'utm_campaign'
            )) ||
        (Object.prototype.hasOwnProperty.call(
            finalParams,
            'entrypoint_experiment'
        ) &&
            Object.prototype.hasOwnProperty.call(
                finalParams,
                'entrypoint_variation'
            ))
    ) {
        return finalParams;
    }

    return null;
};