Skip to content

Commit

Permalink
Upload the updated solution for proxying analytics, resolves #2
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Apr 7, 2019
1 parent 733a81e commit 2417309
Show file tree
Hide file tree
Showing 15 changed files with 866 additions and 131 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Nikita
Copyright (c) 2017-2019 Nikita Savchenko (https://nikita.tk)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
32 changes: 0 additions & 32 deletions README.md

This file was deleted.

46 changes: 0 additions & 46 deletions analytics.js

This file was deleted.

86 changes: 86 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
const env = process.env.APP__ENV_NAME || "local";
const isLocal = env === "local" || env === "test";
const proxyDomain = process.env.PROXY_DOMAIN || "localhost";

export default {
isLocalEnv: isLocal,
httpPort: process.env.PORT || 80,
proxyDomain: proxyDomain, // Your domain
proxy: { // Proxy configuration is here
domains: [ // These domains are replaced in any proxied response (including scripts, URLs and redirects)
"adservice.google.com",
"www.google-analytics.com",
"www.googleadservices.com",
"www.googletagmanager.com",
"google-analytics.bi.owox.com",
"googleads.g.doubleclick.net",
"stats.g.doubleclick.net",
"ampcid.google.com",
"www.google.%",
"www.google.com",
"bat.bing.com",
"static.hotjar.com",
"trackcmp.net",
"connect.facebook.net",
"www.facebook.com",
"rum-static.pingdom.net",
"s.adroll.com",
"d.adroll.com",
"bid.g.doubleclick.net",
"rum-collector-2.pingdom.net",
"script.hotjar.com",
"vars.hotjar.com",
"pixel.advertising.com",
"dsum-sec.casalemedia.com",
"pixel.rubiconproject.com",
"sync.outbrain.com",
"simage2.pubmatic.com",
"trc.taboola.com",
"eb2.3lift.com",
"ads.yahoo.com",
"x.bidswitch.net",
"ib.adnxs.com",
"idsync.rlcdn.com",
"us-u.openx.net",
"cm.g.doubleclick.net"
],
specialContentReplace: { // Special regex rules for domains
"www.googletagmanager.com": [
{
regex: /"https\:\/\/s","http:\/\/a","\.adroll\.com/,
replace: `"https://${ proxyDomain }/s","http://${ proxyDomain }/a",".adroll.com`
}
],
"eb2.3lift.com": [
{ // Because eb2.3lift.com/xuid?mid=_&xuid=_&dongle=_ redirects to "/xuid" which doesn't exists
regex: /^\/xuid/,
replace: "https://eb2.3lift.com/xuid" // eb2.3lift.com is replaced then again with the correct proxy
}
]
},
ipOverrides: { // IP override rules for domains
"google-analytics.bi.owox.com": { // Currently, this is useless as owox.com is having problems with overriding IP addresses, even though they state that they support everything from the Google Measurement Protocol.
urlMatch: /\/collect/,
queryParameterName: ["uip", "device.ip"]
},
"www.google-analytics.com": {
urlMatch: /\/collect/,
queryParameterName: "uip"
}
},
maskPaths: [ // Paths which are masked in URLs and redirects in order to avoid firing ad-blocking rules
"/google-analytics",
"/r/collect",
"/j/collect",
"/pageread/conversion",
"/pagead/conversion",
"/googleads",
"/prum",
"/beacon",
"/pixel",
"/AdServer",
"/ads/",
"openx\\."
],
}
};
17 changes: 0 additions & 17 deletions index.html

This file was deleted.

Loading

0 comments on commit 2417309

Please sign in to comment.