title: making a session cookie expire in 2 years
body: <p>I have the below script that sets cookies and pulls values into the forms. What I am struggling with is setting the expiration date for 2 years?
        </p>
  
  <pre><code>      // Parse the URL
        function getParameterByName(name) {
        name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
        var regex = new RegExp("[\\?&amp;]" + name + "=([^&amp;#]*)"),
        results = regex.exec(location.search);
        return results === null ? "" : 
        decodeURIComponent(results[1].replace(/\+/g, " "));
        }
  
        // Give the URL parameters variable names
        var source = getParameterByName('utm_source');
        var keyword = getParameterByName('keyword');
        var medium = getParameterByName('utm_medium');
        var campaign = getParameterByName('utm_campaign');
        var _ga = getParameterByName('_ga');
        var gclid = getParameterByName('gclid');
        var clientId = getParameterByName('clientId');
  
        // Set the cookies
        if(Cookies.set('utm_source') == null || Cookies.set('utm_source') == 
        "") { 
        Cookies.set('utm_source', source, { path: ''}); 
        }
        if(Cookies.set('keyword') == null || Cookies.set('keyword') == "") {
        Cookies.set('keyword', keyword, { path: '' });
        }
        if(Cookies.set('utm_medium') == null || Cookies.set('utm_medium') ==                     
        "") {
        Cookies.set('utm_medium', medium, { path: '' });
        }
        if(Cookies.set('utm_campaign') == null || Cookies.set('utm_campaign') 
        == "") {
        Cookies.set('utm_campaign', campaign, { path: '' });
        }
        if(Cookies.set('_ga') == null || Cookies.set('_ga') == "") {
        Cookies.set('_ga', _ga, { path: '' });
        }
        if(Cookies.set('gclid') == null || Cookies.set('gclid') == "") {
        Cookies.set('gclid', gclid, { path: '' });
        }
        if(Cookies.set('clientId') == null || Cookies.set('clientId') == "") {
        Cookies.set('clientId', clientId, { path: '' });
        }
  
        // Grab the cookie value and set the form field values
        $(document).ready(function(){
        $("input[name=utm_source]:hidden").val(source);
        $("input[name=keyword]:hidden").val(keyword);
        $("input[name=utm_medium]:hidden").val(medium);
        $("input[name=gclid]:hidden").val(gclid);
        $("input[name=utm_campaign]:hidden").val(campaign);
        $("input[name=_ga]:hidden").val(_ga);
        $("input[name=clientId]:hidden").val (clientId);
        });
       &lt;/script&gt;
  </code></pre>
  
  <p>Thanks - everthing above works as expected but I have having a hard time setting the cookies to expire in two years - I have tried various [expires] but to no avail.</p>