Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1468 from Qwant/QMAPS-telemetry
Browse files Browse the repository at this point in the history
QMAPS add telemetry
  • Loading branch information
pascaloliv authored Nov 21, 2023
2 parents 8b6e4f5 + a5f0f59 commit fdf5f24
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 5 deletions.
3 changes: 3 additions & 0 deletions language/message/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -1844,3 +1844,6 @@ msgstr "Mehr erfahren"

msgid "Zero waste source poi details"
msgstr "Eine Verkaufsart, die Abfall und Verpackungsabfall begrenzt."

msgid "cookies_management"
msgstr "Verwaltung von Cookies"
5 changes: 4 additions & 1 deletion language/message/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -1737,4 +1737,7 @@ msgid "Zero waste source poi see more"
msgstr "Learn more"

msgid "Zero waste source poi details"
msgstr "Selling without packaging limits wastage and packaging waste."
msgstr "Selling without packaging limits wastage and packaging waste."

msgid "cookies_management"
msgstr "Cookie management"
3 changes: 3 additions & 0 deletions language/message/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -1834,3 +1834,6 @@ msgstr "Más información"

msgid "Zero waste source poi details"
msgstr "Un modo de venta que limita el desperdicio y el desperdicio de empaques."

msgid "cookies_management"
msgstr "Gestión de las cookies"
5 changes: 4 additions & 1 deletion language/message/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -1893,4 +1893,7 @@ msgid "zero_waste"
msgstr "Vente en vrac"

msgid "ecotable"
msgstr "Écotable"
msgstr "Écotable"

msgid "cookies_management"
msgstr "Gestion des cookies"
5 changes: 4 additions & 1 deletion language/message/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -1840,4 +1840,7 @@ msgid "Zero waste source poi see more"
msgstr "Ulteriori informazioni"

msgid "Zero waste source poi details"
msgstr "Una modalità di vendita che limita i rifiuti e i rifiuti di imballaggio."
msgstr "Una modalità di vendita che limita i rifiuti e i rifiuti di imballaggio."

msgid "cookies_management"
msgstr "Gestione dei cookie"
1 change: 1 addition & 0 deletions public/images/remix/cookie.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/ui/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ export { ReactComponent as IconDirectionsArrow } from '../../../public/images/di
export { ReactComponent as IconAndroid } from '../../../public/images/mobile/android.svg';
export { ReactComponent as IconApple } from '../../../public/images/mobile/i-os.svg';
export { ReactComponent as QwantLogoBlue } from '../../../public/images/qwant-search-logo.svg';
export { ReactComponent as IconCookie } from '../../../public/images/remix/cookie.svg';
12 changes: 11 additions & 1 deletion src/panel/menu/AppMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import PropTypes from 'prop-types';
import MenuItem from './MenuItem';
import Telemetry from 'src/libs/telemetry';
import { Divider } from 'src/components/ui';
import { IconHeart, IconHistory, IconEdit, IconBug } from 'src/components/ui/icons';
import { IconHeart, IconHistory, IconEdit, IconBug, IconCookie } from 'src/components/ui/icons';
import { IconLight, IconApps } from '@qwant/qwant-ponents';
import { useConfig, useI18n } from 'src/hooks';

const AppMenu = ({ close, openProducts }) => {
const { baseUrl } = useConfig('system');
const { drawer } = useConfig('telemetry');
const { getLocalizedUrl, _ } = useI18n();
const searchHistoryConfig = useConfig('searchHistory');

Expand Down Expand Up @@ -67,6 +68,15 @@ const AppMenu = ({ close, openProducts }) => {
>
{_('Report a bug', 'menu')}
</MenuItem>
{drawer && drawer.url && (
<MenuItem
href={drawer.url}
target="_self"
icon={<IconCookie width={16} fill="var(--green-500)" />}
>
{_('cookies_management', 'menu')}
</MenuItem>
)}

{openProducts && (
<>
Expand Down
3 changes: 2 additions & 1 deletion src/panel/menu/MenuItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import React from 'react';
import { Flex, IconExternalLink } from '@qwant/qwant-ponents';
import { GREY_SEMI_DARKNESS } from 'src/libs/colors';

const MenuItem = ({ icon, children, href, onClick, outsideLink }) => (
const MenuItem = ({ icon, children, href, onClick, outsideLink, ...props }) => (
<a
className="menu-item"
href={href || '#'}
onClick={onClick}
{...props}
{...(outsideLink
? {
rel: 'noopener noreferrer',
Expand Down
12 changes: 12 additions & 0 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@
<%- `window.__config = ${JSON.stringify(config,
(k,v) => k==='server' ? undefined : v)};` %>
</script>
<% if(config.telemetry.enabled) { %>
<script type="text/javascript">
(function(window, document, dataLayerName, id) {
window[dataLayerName]=window[dataLayerName]||[],window[dataLayerName].push({start:(new Date).getTime(),event:"stg.start"});var scripts=document.getElementsByTagName('script')[0],tags=document.createElement('script');
function stgCreateCookie(a,b,c){var d="";if(c){var e=new Date;e.setTime(e.getTime()+24*c*60*60*1e3),d="; expires="+e.toUTCString();f="; SameSite=Strict"}document.cookie=a+"="+b+d+f+"; path=/"}
var isStgDebug=(window.location.href.match("stg_debug")||document.cookie.match("stg_debug"))&&!window.location.href.match("stg_disable_debug");stgCreateCookie("stg_debug",isStgDebug?1:"",isStgDebug?14:-1);
var qP=[];dataLayerName!=="dataLayer"&&qP.push("data_layer_name="+dataLayerName),isStgDebug&&qP.push("stg_debug");var qPString=qP.length>0?("?"+qP.join("&")):"";
tags.async=!0,tags.src="<%= config.telemetry.url %>"+id+".js"+qPString,scripts.parentNode.insertBefore(tags,scripts);
!function(a,n,i){a[n]=a[n]||{};for(var c=0;c<i.length;c++)!function(i){a[n][i]=a[n][i]||{},a[n][i].api=a[n][i].api||function(){var a=[].slice.call(arguments,0);"string"==typeof a[0]&&window[dataLayerName].push({event:n+"."+i+":"+a[0],parameters:[].slice.call(arguments,1)})}}(i[c])}(window,"ppms",["tm","cm"]);
})(window, document, 'dataLayer', '<%= config.telemetry.token %>');
</script>
<% } %>
<div id="scene_container" class="map_container"></div>
<div id="react_root"></div>
<div id="root"></div>
Expand Down

0 comments on commit fdf5f24

Please sign in to comment.