src/tracker.js
/**
   * Decorates a given URL with a __woopraid query param with value of
   * the current cookie
   */
Decorates a given URL with a __woopraid query param with value of
the current cookie
Decorates a given URL with a __woopraid query param with value of the current cookie
decorate(url) {
    let el;
    let query;
    let pathname;
    let host;
    if (isString(url)) {
      el = document.createElement('a');
      el.href = url;
      query = el.search ? '&' : '?';
    } else if (url && url.href) {
      el = url;
    }
    if (el) {
      query = el.search ? '&' : '?';
      pathname =
        el.pathname && el.pathname.charAt(0) === '/'
          ? el.pathname
          : `/${el.pathname}`;
      host =
        el.hostname +
        (el.port && el.port !== '' && el.port !== '80' && el.port !== '0'
          ? `:${el.port}`
          : '');
      return `${el.protocol}//${host}${pathname}${el.search}${query}${XDM_PARAM_NAME}=${this.cookie}${el.hash}`;
    }
  }
decorate ( url ) { let el ; let query ; let pathname ; let host ; if ( isString ( url ) ) { el = document . createElement ( 'a' ) ; el . href = url ; query = el . search ? '&' : '?' ; } else if ( url && url . href ) { el = url ; } if ( el ) { query = el . search ? '&' : '?' ; pathname = el . pathname && el . pathname . charAt ( 0 ) === '/' ? el . pathname : ` ${ el . pathname } ` ; host = el . hostname + ( el . port && el . port !== '' && el . port !== '80' && el . port !== '0' ? ` ${ el . port } ` : '' ) ; return ` ${ el . protocol } ${ host } ${ pathname } ${ el . search } ${ query } ${ XDM_PARAM_NAME } ${ this . cookie } ${ el . hash } ` ; } }
Decorates a given URL with a __woopraid query param with value of
 the current cookie
Decorates a given URL with a __woopraid query param with value of the current cookie