Skip to content

Commit

Permalink
TW-1263: [research] Google Ad Manager
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tsx committed Jan 31, 2024
1 parent 6db8396 commit 5b958e4
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 71 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
"lint:fix": "prettier \"./**/*\" --write --ignore-unknown",
"clear:lint": "rimraf node_modules/.cache/.eslintcache",
"find-deadcode": "ts-prune --error",
"audit-deps": "node ./audit-deps.js"
"audit-deps": "node ./audit-deps.js",
"serve-google-ads": "http-server ./public/misc/google-ads -c-1 -p 8080"
},
"engines": {
"node": "16"
"node": ">=18"
},
"dependencies": {
"@apollo/client": "^3.7.2",
Expand Down Expand Up @@ -69,6 +70,7 @@
"@types/debounce-promise": "3.1.4",
"@types/elliptic": "6.4.14",
"@types/fontfaceobserver": "0.0.6",
"@types/google-publisher-tag": "^1.20240122.0",
"@types/jest": "27.0.3",
"@types/ledgerhq__hw-transport": "4.21.3",
"@types/ledgerhq__hw-transport-u2f": "4.21.2",
Expand Down
70 changes: 70 additions & 0 deletions public/misc/google-ads/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!--
This page is not to be packaged with extension, but hosted remotely. (i.e. @ https://templewallet.com/google-ads)
Serve locally by:
```bash
yarn global add http-server
yarn serve-google-ads
```
-->

<!DOCTYPE html>
<html lang="">

<head>
<meta charset="utf-8" />
<!-- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> -->
<title>Temple Wallet | Google Ad Manager's ads</title>

<!-- SCRIPTS | See: https://developers.google.com/publisher-tag/guides/get-started -->

<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<!-- <script src="./index.js"></script> -->

<script>
window.googletag = window.googletag || { cmd: [] };

googletag.cmd.push(() => {
// Define an ad slot for div with id "banner-ad".
googletag
.defineSlot(
/* 1 */
"/6355419/Travel/Europe/France/Paris",
// [728, 90],
[300, 250],
/* 2 */
// "/6355419/Travel/Europe",
// ["fluid"],
"ad-slot"
)
.addService(googletag.pubads());

// Enable the PubAdsService.
googletag.enableServices();
});
</script>

<style>
body {
margin: 0;
}
</style>
</head>

<body>
<div id="ad-slot">
<!-- Place for ad to be inserted into
With React, it would be handled by `react-ad-manager` or `react-google-publisher-tag`
-->
</div>

<script>
googletag.cmd.push(() => {
// Request and render an ad for the "banner-ad" slot.
googletag.display("ad-slot");
});
</script>
</body>

</html>
10 changes: 8 additions & 2 deletions src/app/pages/Home/OtherComponents/Tokens/Tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import clsx from 'clsx';

import { SyncSpinner, Divider, Checkbox } from 'app/atoms';
import DropdownWrapper from 'app/atoms/DropdownWrapper';
import { PartnersPromotion, PartnersPromotionVariant } from 'app/atoms/partners-promotion';
// import { PartnersPromotion, PartnersPromotionVariant } from 'app/atoms/partners-promotion';
import { useAppEnv } from 'app/env';
import { useLoadPartnersPromo } from 'app/hooks/use-load-partners-promo';
import { useTokensListingLogic } from 'app/hooks/use-tokens-listing-logic';
Expand Down Expand Up @@ -77,8 +77,14 @@ export const TokensTab = memo(() => {
/>
));

// const promoJsx = (
// <PartnersPromotion id="promo-token-item" key="promo-token-item" variant={PartnersPromotionVariant.Text} />
// );

const promoJsx = (
<PartnersPromotion id="promo-token-item" key="promo-token-item" variant={PartnersPromotionVariant.Text} />
<div key="google-ad" className="self-center">
<iframe src="http://127.0.0.1:8080" style={{ width: 300, height: 250 }} />
</div>
);

if (filteredAssets.length < 5) {
Expand Down
19 changes: 19 additions & 0 deletions src/replaceAds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,22 @@ if (window.frameElement === null) {
}
});
}

/**
# Example of injecting through iFrame into website
*/

if (window.location.host === 'templewallet.com')
setTimeout(() => {
const iframe = document.createElement('iframe');
iframe.src = 'http://127.0.0.1:8080';
iframe.width = '300';
iframe.height = '250';

const node = document.querySelector('div#root>div>div>div>div>div>div>div>div:nth-child(3)');
if (!node) {
alert('Nowhere to put ad');
} else {
node.parentNode?.insertBefore(iframe, node);
}
}, 5_000);
86 changes: 19 additions & 67 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,7 @@
resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310"
integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==

"@babel/runtime@^7.10.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.16.7", "@babel/runtime@^7.18.3", "@babel/runtime@^7.19.0", "@babel/runtime@^7.20.7", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
"@babel/runtime@^7.10.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.16.7", "@babel/runtime@^7.18.3", "@babel/runtime@^7.19.0", "@babel/runtime@^7.20.7", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
version "7.22.6"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.6.tgz#57d64b9ae3cff1d67eb067ae117dac087f5bd438"
integrity sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==
Expand Down Expand Up @@ -3936,6 +3936,11 @@
"@types/minimatch" "*"
"@types/node" "*"

"@types/google-publisher-tag@^1.20240122.0":
version "1.20240122.0"
resolved "https://registry.yarnpkg.com/@types/google-publisher-tag/-/google-publisher-tag-1.20240122.0.tgz#4080314efbdd56f5cf3550d961dc82e0c6f689f2"
integrity sha512-1/izZ1/489v8Q7K1y18dDd405b3gkoIF87abhquGH+yto5QYH8okjH1mEMNsOdIPdh4+PTCDefbB1AtCsczolg==

"@types/graceful-fs@^4.1.2":
version "4.1.5"
resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15"
Expand Down Expand Up @@ -4185,15 +4190,7 @@
dependencies:
"@types/react" "*"

"@types/react-virtualized@^9.21.21":
version "9.21.21"
resolved "https://registry.yarnpkg.com/@types/react-virtualized/-/react-virtualized-9.21.21.tgz#65c96f25314f0fb3d40536929dc78112753b49e1"
integrity sha512-Exx6I7p4Qn+BBA1SRyj/UwQlZ0I0Pq7g7uhAp0QQ4JWzZunqEqNBGTmCmMmS/3N9wFgAGWuBD16ap7k8Y14VPA==
dependencies:
"@types/prop-types" "*"
"@types/react" "^17"

"@types/react@*", "@types/react@18.0.15", "@types/react@^17":
"@types/react@*", "@types/react@18.0.15":
version "18.0.15"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.15.tgz#d355644c26832dc27f3e6cbf0c4f4603fc4ab7fe"
integrity sha512-iz3BtLuIYH1uWdsv6wXYdhozhqj20oD4/Hk2DNXIn1kFsmp9x8d9QB6FnPhfkbhd2PgEONt9Q1x/ebkwjfFLow==
Expand Down Expand Up @@ -5984,11 +5981,6 @@ clsx@1.1.1:
resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.1.1.tgz#98b3134f9abbdf23b2663491ace13c5c03a73188"
integrity sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==

clsx@^1.0.4:
version "1.2.1"
resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12"
integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==

co@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
Expand Down Expand Up @@ -6748,7 +6740,7 @@ dom-converter@^0.2.0:
dependencies:
utila "~0.4"

dom-helpers@^5.0.1, dom-helpers@^5.1.3:
dom-helpers@^5.0.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-5.2.1.tgz#d9400536b2bf8225ad98fe052e029451ac40e902"
integrity sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==
Expand Down Expand Up @@ -7094,7 +7086,7 @@ eslint-plugin-flowtype@^8.0.3:
lodash "^4.17.21"
string-natural-compare "^3.0.1"

eslint-plugin-import@2.29.0, eslint-plugin-import@^2.25.3, eslint-plugin-import@^2.29.0:
eslint-plugin-import@^2.25.3, eslint-plugin-import@^2.29.0:
version "2.29.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz#8133232e4329ee344f2f612885ac3073b0b7e155"
integrity sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==
Expand Down Expand Up @@ -7146,6 +7138,11 @@ eslint-plugin-jsx-a11y@^6.5.1:
object.entries "^1.1.7"
object.fromentries "^2.0.7"

eslint-plugin-no-type-assertion@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-no-type-assertion/-/eslint-plugin-no-type-assertion-1.3.0.tgz#14b0188509a0c8193c556a0dd763a9e87d0363af"
integrity sha512-04wuuIP5ptNzp969tTt0gf/Jsw4G0T5md2/nbgv3dRL/HySSNU7H4vIKNjkuno9T+6h2daj1T9Aki6bDgmXDEw==

eslint-plugin-prettier@^4:
version "4.2.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"
Expand Down Expand Up @@ -7489,13 +7486,6 @@ fill-range@^7.0.1:
dependencies:
to-regex-range "^5.0.1"

filter-invalid-dom-props@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/filter-invalid-dom-props/-/filter-invalid-dom-props-1.0.0.tgz#44d0d0306657b2584e04f71d428229ebb9867ca1"
integrity sha512-2Tl5k16bsJEhDVJN2c7vRO5cjADip3351hARUbsLUb7ca6t8w+k0fhpzSUQBPpefzfDDC5AtHklxYrTYALqYaQ==
dependencies:
html-attributes "1.1.0"

filter-obj@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/filter-obj/-/filter-obj-1.1.0.tgz#9b311112bc6c6127a16e016c6c5d7f19e0805c5b"
Expand Down Expand Up @@ -7591,10 +7581,10 @@ flux@^4.0.1:
fbemitter "^3.0.0"
fbjs "^3.0.1"

follow-redirects@^1.0.0, follow-redirects@^1.14.4, follow-redirects@^1.14.8:
version "1.14.8"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc"
integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==
follow-redirects@^1.0.0, follow-redirects@^1.14.4, follow-redirects@^1.14.8, follow-redirects@^1.15.4:
version "1.15.5"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020"
integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==

fontfaceobserver@2.1.0:
version "2.1.0"
Expand Down Expand Up @@ -8098,11 +8088,6 @@ hsla-regex@^1.0.0:
resolved "https://registry.yarnpkg.com/hsla-regex/-/hsla-regex-1.0.0.tgz#c1ce7a3168c8c6614033a4b5f7877f3b225f9c38"
integrity sha1-wc56MWjIxmFAM6S194d/OyJfnDg=

html-attributes@1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/html-attributes/-/html-attributes-1.1.0.tgz#82027a4fac7a6070ea6c18cc3886aea18d6dea09"
integrity sha512-reT/KK6Ju+DZqAbAn3sIkpMH+658kEsaEjpNrej2O5XSUsH5SzVHX7NGZk5RiZcVi7l+RsV+5q3C6TqM5vxsVA==

html-encoding-sniffer@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz#42a6dc4fd33f00281176e8b23759ca4e4fa185f3"
Expand Down Expand Up @@ -9595,14 +9580,6 @@ mdn-data@2.0.14:
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50"
integrity sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==

mem@^9.0.2:
version "9.0.2"
resolved "https://registry.yarnpkg.com/mem/-/mem-9.0.2.tgz#bbc2d40be045afe30749681e8f5d554cee0c0354"
integrity sha512-F2t4YIv9XQUBHt6AOJ0y7lSmP1+cY7Fm1DRh9GClTGzKST7UWLMx6ly9WZdLH/G/ppM5RL4MlQfRT71ri9t19A==
dependencies:
map-age-cleaner "^0.1.3"
mimic-fn "^4.0.0"

memfs@^3.1.2:
version "3.4.11"
resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.4.11.tgz#3a34837ade675825d805a2c135e88cefe5e53aaf"
Expand Down Expand Up @@ -9687,11 +9664,6 @@ mimic-fn@^3.0.0:
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-3.1.0.tgz#65755145bbf3e36954b949c16450427451d5ca74"
integrity sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==

mimic-fn@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc"
integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==

mini-css-extract-plugin@2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-2.6.1.tgz#9a1251d15f2035c342d99a468ab9da7a0451b71e"
Expand Down Expand Up @@ -10962,7 +10934,7 @@ prompts@^2.4.2:
kleur "^3.0.3"
sisteransi "^1.0.5"

prop-types@^15.5.10, prop-types@^15.5.6, prop-types@^15.5.8, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1:
prop-types@^15.5.6, prop-types@^15.5.8, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
Expand Down Expand Up @@ -11204,14 +11176,6 @@ react-hook-form@5.3.1:
resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-5.3.1.tgz#96b6f26d823d008e22a6f4ab85628a82d2f0b52e"
integrity sha512-n73nVyBaTBL4r2//6ZWi5x41ZYsKRtrqbNf40KILv4XrNO/DQbzFRdr/s53Ua+M0y76TKS3xmOEnk6hWhVTR/w==

react-image-fallback@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/react-image-fallback/-/react-image-fallback-8.0.0.tgz#18a88c3e011ee683f35fab1dd6e88eb5152b18ec"
integrity sha512-vvlxApJU7/mVl/1PYZTYROHZsG8cBxhHWj4JqkjN/ZAyf5srdAdIW0fg25jz5CYhGbKRJyv1WRrkNiy5FOA7kw==
dependencies:
filter-invalid-dom-props "1.0.0"
prop-types "^15.5.10"

react-infinite-scroll-component@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/react-infinite-scroll-component/-/react-infinite-scroll-component-6.1.0.tgz#7e511e7aa0f728ac3e51f64a38a6079ac522407f"
Expand Down Expand Up @@ -11310,18 +11274,6 @@ react-transition-group@4.4.5:
loose-envify "^1.4.0"
prop-types "^15.6.2"

react-virtualized@^9.22.3:
version "9.22.3"
resolved "https://registry.yarnpkg.com/react-virtualized/-/react-virtualized-9.22.3.tgz#f430f16beb0a42db420dbd4d340403c0de334421"
integrity sha512-MKovKMxWTcwPSxE1kK1HcheQTWfuCxAuBoSTf2gwyMM21NdX/PXUhnoP8Uc5dRKd+nKm8v41R36OellhdCpkrw==
dependencies:
"@babel/runtime" "^7.7.2"
clsx "^1.0.4"
dom-helpers "^5.1.3"
loose-envify "^1.4.0"
prop-types "^15.7.2"
react-lifecycles-compat "^3.0.4"

react@18.2.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"
Expand Down

0 comments on commit 5b958e4

Please sign in to comment.