From d41ac9205e77e3df6ba6b27ef2933d5ea622895f Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Sun, 1 Dec 2019 15:11:28 +0400 Subject: [PATCH] Remove utm params from share URLs --- lib/url.js | 33 ++++----------------------------- package.json | 1 - yarn.lock | 19 ------------------- 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/lib/url.js b/lib/url.js index 3025c203f..293bec739 100644 --- a/lib/url.js +++ b/lib/url.js @@ -1,4 +1,3 @@ -import queryString from 'query-string'; import siteConfig from 'storage/site'; export const prefixHost = (url) => { @@ -12,41 +11,17 @@ export const getTwitterUrl = (username) => { }; export const getTwitterShareUrl = ({ text, url }) => { - const urlToShare = `${prefixHost(url)}?${queryString.stringify({ - utm_source: 'roadmap.sh', - utm_campaign: 'share', - utm_medium: 'twitter', - })}`; - - return `https://twitter.com/intent/tweet?text=${text}&url=${encodeURI(urlToShare)}`; + return `https://twitter.com/intent/tweet?text=${text}&url=${encodeURI(prefixHost(url))}`; }; export const getFacebookShareUrl = ({ text, url }) => { - const urlToShare = `${prefixHost(url)}?${queryString.stringify({ - utm_source: 'roadmap.sh', - utm_campaign: 'share', - utm_medium: 'facebook', - })}`; - - return `https://www.facebook.com/sharer/sharer.php?quote=${text}&u=${encodeURI(urlToShare)}`; + return `https://www.facebook.com/sharer/sharer.php?quote=${text}&u=${encodeURI(prefixHost(url))}`; }; export const getRedditShareUrl = ({ text, url }) => { - const urlToShare = `${prefixHost(url)}?${queryString.stringify({ - utm_source: 'roadmap.sh', - utm_campaign: 'share', - utm_medium: 'reddit' - })}`; - - return `https://www.reddit.com/submit?title=${text}&url=${encodeURI(urlToShare)}`; + return `https://www.reddit.com/submit?title=${text}&url=${encodeURI(prefixHost(url))}`; }; export const getHnShareUrl = ({ text, url }) => { - const urlToShare = `${prefixHost(url)}?${queryString.stringify({ - utm_source: 'roadmap.sh', - utm_campaign: 'share', - utm_medium: 'hn' - })}`; - - return `https://news.ycombinator.com/submitlink?t=${text}&u=${urlToShare}`; + return `https://news.ycombinator.com/submitlink?t=${text}&u=${prefixHost(url)}`; }; diff --git a/package.json b/package.json index 37315e942..63b4c08c3 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ "node-sass": "^4.12.0", "postcss-css-variables": "^0.13.0", "prism-themes": "^1.3.0", - "query-string": "^6.8.3", "react": "^16.9.0", "react-dom": "^16.9.0", "styled-components": "^4.4.0" diff --git a/yarn.lock b/yarn.lock index e32dc581a..4de4af068 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6920,15 +6920,6 @@ query-string@^4.1.0: object-assign "^4.1.0" strict-uri-encode "^1.0.0" -query-string@^6.8.3: - version "6.8.3" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.8.3.tgz#fd9fb7ffb068b79062b43383685611ee47777d4b" - integrity sha512-llcxWccnyaWlODe7A9hRjkvdCKamEKTh+wH8ITdTc3OhchaqUZteiSCX/2ablWHVrkVIe04dntnaZJ7BdyW0lQ== - dependencies: - decode-uri-component "^0.2.0" - split-on-first "^1.0.0" - strict-uri-encode "^2.0.0" - querystring-es3@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" @@ -7796,11 +7787,6 @@ spdx-license-ids@^3.0.0: resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== -split-on-first@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f" - integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw== - split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" @@ -7912,11 +7898,6 @@ strict-uri-encode@^1.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= -strict-uri-encode@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" - integrity sha1-ucczDHBChi9rFC3CdLvMWGbONUY= - string-hash@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b"