Skip to content

Commit

Permalink
Add Google Ads integration and ad blocking recovery scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmesh-hemaram committed Dec 15, 2024
1 parent f95ab02 commit 8bfa2d4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/acf-options-page/src/app/configs/configs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createRef, useEffect } from 'react';
import { Alert, Col, Container, Row } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { download } from '../../_helpers';
import { Ads } from '../../components';
import { useAppDispatch } from '../../hooks';
import { ConfigSettingsModal, RemoveConfigsModal, ReorderConfigsModal } from '../../modal';
import { BatchModal } from '../../modal/config-batch.modal';
Expand Down Expand Up @@ -79,6 +80,7 @@ function Configs(props) {
)}
<Config />
<Action />
<Ads />
<Footer />
<ConfigSettingsModal />
<BatchModal />
Expand Down
41 changes: 41 additions & 0 deletions apps/acf-options-page/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<meta property="og:image:height" content="640" />
<link rel="image_src" href="https://getautoclicker.com/docs/4.x/assets/brand/bootstrap-social.png" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous" />
<!-- Google Ads -->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9512495707028343" crossorigin="anonymous"></script>
<!-- End Google Ads-->
</head>
<body class="bg-body-secondary">
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand All @@ -59,5 +62,43 @@
})(window, document, 'script', 'dataLayer', 'GTM-KWCS372');
</script>
<!-- End Google Tag Manager -->
<!-- Ad blocking recovery -->
<script async src="https://fundingchoicesmessages.google.com/i/pub-9512495707028343?ers=1" nonce="zG-XMu9e9eZgUA3cG1msWw"></script>
<script nonce="zG-XMu9e9eZgUA3cG1msWw">
(function () {
function signalGooglefcPresent() {
if (!window.frames['googlefcPresent']) {
if (document.body) {
const iframe = document.createElement('iframe');
iframe.style = 'width: 0; height: 0; border: none; z-index: -1000; left: -1000px; top: -1000px;';
iframe.style.display = 'none';
iframe.name = 'googlefcPresent';
document.body.appendChild(iframe);
} else {
setTimeout(signalGooglefcPresent, 0);
}
}
}
signalGooglefcPresent();
})();
</script>
<!-- End of Ad blocking recovery -->
<!-- Delete the Funding Choices cookie if consent is more than 12 months old -->
<script>
try {
const nm = 'FCCDCF'; // Match name of Funding Choices cookie
const dm = 'getautoclicker.com'; // Match domain of Funding Choices cookie
const pa = '/'; // Match path of Funding Choices cookie
let tc = ('; ' + document.cookie).split('; ' + nm + '=');
if (tc.length === 2) {
tc = decodeURIComponent(tc.pop().split(';').shift());
tc = JSON.parse(tc)[3][0].substring(1, 9);
tc = Uint8Array.from(window.atob(tc), (v) => v.charCodeAt(0));
let dt = tc[0] * 2 ** 28 + tc[1] * 2 ** 20 + tc[2] * 2 ** 12 + tc[3] * 2 ** 4 + (tc[4] >> 4);
if (Date.now() / 1000 - dt / 10 > 86400 * 365) document.cookie = nm + '=;path=' + pa + ';domain=' + dm + ';expires=' + new Date(0).toUTCString();
}
} catch (e) {}
</script>
<!-- End of Deleting cooking -->
</body>
</html>

0 comments on commit 8bfa2d4

Please sign in to comment.