Refactored removetracking and added a new tracking parameter.

This commit is contained in:
Martin Dosch 2019-05-31 12:48:03 +02:00
parent ca53b16a89
commit 8ac7a60770

View file

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