Skip to content

Commit

Permalink
deeplink
Browse files Browse the repository at this point in the history
  • Loading branch information
sgotre committed Dec 27, 2018
1 parent c87098f commit 493adcc
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
Binary file modified dist/chrome.zip
Binary file not shown.
Binary file modified dist/firefox.zip
Binary file not shown.
Binary file modified dist/opera.zip
Binary file not shown.
1 change: 1 addition & 0 deletions resources/deeplinks.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1095,3 +1095,4 @@ ES;15127;true;http://web.epartner.es/click.aspx?site=15127&ref=[ref]&type=text&t
DE;3441;true;http://partners.webmasterplan.com/click.aspx?site=3441&ref=[ref]&type=text&tnb=6&diurl=[deeplink];affiliate=affilinet;
DE;17046;true;http://partners.webmasterplan.com/click.aspx?site=17046&ref=[ref]&type=text&tnb=1&diurl=[deeplink];;
DE;2950;true;http://partners.webmasterplan.com/click.aspx?site=2950&ref=[ref]&type=text&tnb=1&diurl=[deeplink];;https://www.otto.de/extern/?AffiliateID=LA992&campid=LA78701&IWL=054&page=
DE;16901;true;http://partners.webmasterplan.com/click.aspx?site=16901&ref=[ref]&type=text&tnb=1&diurl=[deeplink];rbtc=aff|dea|$ref$||p|Affiliate_Tarife|&dclid=CNWsh7-fwN8CFQWuUQodOlsInA;https://apiservices.krxd.net/click_tracker/track?kxconfid=rvq31sie0&kxadvertiserid=6522538&kxcampaignid=20913478&kxadid=416651527&kxsiteid=3377722&kxplacementid=218080038&kxcreativeid=99681957&kxsitename=N195005.149763AFFILINET&clk=
3 changes: 2 additions & 1 deletion src/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ext.runtime.onMessage.addListener(

break;
case "copyDeeplink" :
console.log('copy deeplink');
generateTrackingUrl(request.data.uri).then( (deeplink) => {
console.log('copy deeplink', deeplink);
_copyTextToClipboard(deeplink);
Expand Down Expand Up @@ -205,7 +206,7 @@ function generateTrackingUrl(url) {
hasDeeplink(programDetails.programId).then(
(result) => {
if (result.deeplinkInfo === false || result.publisherId === null) {
resolve(url);
resolve(url);
} else {
resolve(generateDeeplink(url, result.publisherId, result.deeplinkInfo))
}
Expand Down
29 changes: 25 additions & 4 deletions src/scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,33 @@ function generateDeeplink(publisherId, deeplinkInfo) {
}
let finalUrl = deeplinkParser.href;

// redirect form tracking url to attribution solution?
if (deeplinkInfo.hasOwnProperty('programId')) {
// special workaround for media markt
if (deeplinkInfo.programId === '16901') {
finalUrl = finalUrl.replace("%2B","%25252B");
}

// special workaround for otto
if (deeplinkInfo.programId === '2950') {
finalUrl = finalUrl.replace(/^https?:\/\/.*otto\.de\//,"");
}
}


/// redirect tracking url to attribution solution?
if (deeplinkInfo.hasOwnProperty('redirector')) {
if (deeplinkInfo.redirector !== '') {
// do not directly redirect to advertiser
finalUrl = deeplinkInfo.redirector + encodeURIComponent(finalUrl);
if (deeplinkInfo.redirector !== '') {
// do not directly redirect to advertiser

// should the redirector param be url encoded?
// partners.webmasterplan.com/?diurl=http://redirector.com/?url={endocedOrUnencodedUrl}
if (!deeplinkInfo.hasOwnProperty('urlencodeRedirectorUrl') || deeplinkInfo.urlencodeRedirectorUrl === 'true') {
finalUrl = deeplinkInfo.redirector + encodeURIComponent(finalUrl);
} else {
finalUrl = deeplinkInfo.redirector + finalUrl;
}

}
}

trackingLink = trackingLink.replace('[deeplink]', encodeURIComponent(finalUrl));
Expand Down

0 comments on commit 493adcc

Please sign in to comment.