-2

I looking for solution that will allowed me to use redirection and store in CSV files the parameters from specific URL.

I have a link: http://my-server.com/?url={link}&campaign={campaign_name}&date={date}

Example:

http://my-server.com/?url=google.com&campaign=web&date=17062016

When the user will click in the link, they will be redirect to google.com, but the 3 parameters: url, campaign and date, will be store in CSV files on my server.

When I'm using 'window.location.href' I lost the all parameters.

pjmorse
  • 9,204
  • 9
  • 54
  • 124
baf
  • 1
  • Is this server-side JS? I'm confused by your use of `window`. If this isn't server-side JS, then how do you plan on writing to a file? (Btw `location.search` stores the query string) – 4castle Jun 17 '16 at 19:31

1 Answers1

1

It seems like you'd need to get the GET query parameters on your server to accomplish what you're talking about. In which case, how you accomplish that will depend on what language you're using on the server side.

If I'm misinterpreting your question, and you're only trying to grab the query parameters on the client side (i.e. the values of url and campaign) then you need to do a little extra parsing. Check out How can I get query string values in JavaScript? for information on how to accomplish that.

Community
  • 1
  • 1