1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-21 22:47:43 +00:00
Files
matomo/tests/resources/overlay-test-site/opt-out.php
Marc Neudert 341e8e9b62 Fix OptOutJS test breaking CI headless browser (#22284)
* Reduce timeout for no-tracker implementation

* Make "page.clearCookies" more resilient
2024-06-05 08:49:42 +12:00

65 خطوط
2.5 KiB
PHP

<?php
?><!DOCTYPE html>
<html lang="en">
<head>
<title>Opt Out UI Test</title>
<style>
* {
font-family: Arial !important;
}
</style>
</head>
<body>
<h1>Opt Out</h1>
<?php
$implementation = $_GET['implementation'] ?? '';
$loadTracker = '1' === ($_GET['loadTracker'] ?? '1');
?>
<?php if ('iframe' === $implementation) : ?>
<h2>Iframe</h2>
<iframe id="optOutIframe" src="../../../index.php?module=CoreAdminHome&action=optOut&language=en"></iframe>
<?php elseif ('js' === $implementation) : ?>
<h2>JS</h2>
<div style="border: 1px solid black; padding: 8px; width: 640px">
<div id="matomo-opt-out"></div>
<?php
$optOutArgs = [
'divId' => $_GET['divId'] ?? 'matomo-opt-out',
'showIntro' => '1',
'useCookiesIfNoTracker' => $loadTracker ? '0' : '1',
'useCookiesTimeout' => $loadTracker ? '' : '1',
];
?>
<script src="../../../index.php?module=CoreAdminHome&action=optOutJS&language=auto&<?= http_build_query($optOutArgs) ?>"></script>
</div>
<?php else : ?>
<strong>Missing or unknown implementation parameter!</strong>
<?php endif ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<?php if ($loadTracker) : ?>
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://%trackerBaseUrl%" : "http://%trackerBaseUrl%");
document.write(unescape("%3Cscript src='" + pkBaseURL + "matomo.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script>
var pkBaseURL = (("https:" == document.location.protocol) ? "https://%trackerBaseUrl%" : "http://%trackerBaseUrl%");
try {
var piwikTracker = Piwik.addTracker(pkBaseURL + "matomo.php", %idSite%);
piwikTracker.setCookieDomain('*.piwik.org');
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {
console.log(err.stack || err.message);
}
</script>
<?php endif ?>
</body>
</html>