Refactored removetracking and added a new tracking parameter.

This commit is contained in:
Martin Dosch 2019-05-31 12:48:03 +02:00 committed by Martin Dosch
parent 071b62dad8
commit 2230294f1b

View file

@ -18,25 +18,14 @@ func removeTracking(input string) (output string, err error) {
return input, err return input, err
} }
// Remove the URL part starting with "?utm_", which is output = resp.Request.URL.String()
// used for tracking purposes.
output = strings.Split(resp.Request.URL.String(), "?utm_")[0]
// Remove the URL part starting with "?wt_", which is // Remove the URL part starting with known tracking parameters.
// used for Webtrekk tracking. trackingParameters := [6]string{"?utm_", "?wt_", "#ref=", "?ref=", "?pk_", "?source="}
output = strings.Split(output, "?wt_")[0]
// Remove the URL part starting with "#ref=", which is for _, trackingParameter := range trackingParameters {
// used for tracking the referer by some feeds. output = strings.Split(output, trackingParameter)[0]
output = strings.Split(output, "#ref=")[0] }
// Remove the URL part starting with "?ref=", which is
// used for tracking the referer by some feeds.
output = strings.Split(output, "?ref=")[0]
// Remove the URL part starting with "?pk_", which is
// used for tracking purposes.
output = strings.Split(output, "?pk_")[0]
return output, err return output, err
} }