<commit_before>var queryParams = require('query-params');
var extend = require('util-extend');
var finnBanner = require('./finnPlugins');
var ADTECH_SPLIT = '|ADTECH;';
var URL_SEP = ';';

function init(gardr) {
    gardr.on('params:parsed', registerFeedPlugin);
}

function registerFeedPlugin(gardrParams) {
    finnBanner.registerPlugin('contextData', function() {

        var paramData = createParamData(decodeURIComponent(gardrParams.url));

        var keyValues = {
            kvuserid: gardrParams.kvuserid || (paramData ? paramData.params.kvuserid : ''),
            kvuserareaid: gardrParams.kvuserareaid || (paramData ? paramData.params.kvuserareaid : '')
        };

        return extend(paramData, {
            keyvalues: queryParams.encode(keyValues, URL_SEP),
            data: keyValues
        });
    });
}

function createParamData(url) {
    if (url.indexOf(ADTECH_SPLIT) > -1) {
<commit_msg>Extended feed plugin to send feed data as json<commit_after>var queryParams = require('query-params');
var extend = require('util-extend');
var finnBanner = require('./finnPlugins');
var ADTECH_SPLIT = '|ADTECH;';
var URL_SEP = ';';

function init(gardr) {
    gardr.on('params:parsed', registerFeedPlugin);
}

function registerFeedPlugin(gardrParams) {
    finnBanner.registerPlugin('contextData', function() {

        var paramData = createParamData(decodeURIComponent(gardrParams.url));

        var keyValues = {
            kvuserid: gardrParams.kvuserid || (paramData ? paramData.params.kvuserid : ''),
            kvuserareaid: gardrParams.kvuserareaid || (paramData ? paramData.params.kvuserareaid : '')
        };

        return extend(paramData, {
            keyvalues: queryParams.encode(keyValues, URL_SEP),
            data: keyValues
        });
    });

    finnBanner.registerPlugin('feedData', function() {
        if (gardrParams.data && gardrParams.data.feed) {
            return gardrParams.data.feed;
        }
    });
}

function createParamData(url) {
    if (url.indexOf(ADTECH_SPLIT) > -1) {

{'fraction_non_alphanumeric': 0.13212180746561886, 'fraction_numerical': 0.0009823182711198428, 'mean_word_length': 3.3525641025641026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7520993', 'n_tokens_mistral': 648, 'n_tokens_neox': 638, 'n_words': 109}