url-tracking-stripper
url-tracking-stripper copied to clipboard
Add support for ad.doubleclick.net track link
Example URLs:
- http://ad.doubleclick.net/clk;274204538;98873843;y?http://www.food.com/recipe/cuban-pork-adobo-salad-501729
- http://ad.doubleclick.net/clk;272664759;101583304;i?http://www.porkbeinspired.com/RecipeDetail/2770/Cuban_Pork_Adobo_Salad.aspx
As you can see, doubleclick track link doesn't put target URL in any parameters, targetParam
method can't fit this case.
I'd like to propose to use regex for parsing target URLs also keep the current "param" parse method:
Add targetRegex
:
{
name: 'Doubleclick',
targetRegex: /\?(.*)$/,
// targetParam: "url",
patterns: [
`${SCHEMA}ad.doubleclick.net${PATH}?`
],
types: ['main_frame']
}
OR
Add parseMethod
to make it explicit:
{
name: 'Doubleclick',
parseMethod: "regex", // Accepts: "param" | "regex"
target: /\?(.*)$/, // Accept types: string | regex
patterns: [
`${SCHEMA}ad.doubleclick.net${PATH}?`
],
types: ['main_frame']
}
OR
Use target
: (one property to rule them all)
{
name: 'Doubleclick',
target: /\?(.*)$/, // Accept types: string | regex
patterns: [
`${SCHEMA}ad.doubleclick.net${PATH}?`
],
types: ['main_frame']
}
However, this implementation requires a major revamp, so would like to hear some feedback.