Merge branch 'master' into creation-ae

pull/917/head
Loic GUILLOIS 2020-03-09 13:26:09 +01:00 committed by GitHub
commit 7f8a2aa8c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 7 deletions

View File

@ -257,13 +257,28 @@
<% if (htmlWebpackPlugin.options.injectTrackingScript) { %>
<script type="text/javascript">
var _paq = window._paq || []
_paq.push([
function() {
var self = this
function getOriginalVisitorCookieTimeout() {
var now = new Date(),
nowTs = Math.round(now.getTime() / 1000),
visitorInfo = self.getVisitorInfo()
var createTs = parseInt(visitorInfo[2])
var cookieTimeout = 33696000 // 13 mois en secondes
var originalTimeout = createTs + cookieTimeout - nowTs
return originalTimeout
}
this.setVisitorCookieTimeout(getOriginalVisitorCookieTimeout())
}
])
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['setDocumentTitle', document.domain + '/' + document.title])
_paq.push([
'setDomains',
['*.mon-entreprise.fr', '*.mycompanyinfrance.fr']
])
_paq.push(['trackPageView'])
_paq.push(['enableHeartBeatTimer', 30])
_paq.push(['enableLinkTracking'])
;(function() {
@ -297,7 +312,7 @@
-->
<script src="https://polyfill.io/v3/polyfill.min.js?features=Intl.~locale.en%2CIntl.~locale.fr%2CIntersectionObserver"></script>
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
<!-- <script nomodule src="<%= chunk %>.legacy.bundle.js"></script> -->
<script nomodule src="<%= chunk %>.legacy.bundle.js"></script>
<% } %>
</body>
</html>

View File

@ -240,7 +240,7 @@ contrat salarié . déduction forfaitaire spécifique . application:
déduction afin d'accorder plus de droits au salarié, notamment en terme de
retraite et d'assurance chômage.
titre: application de la DFS
par défaut: oui
formule: oui
contrat salarié . CDD . taxe forfaitaire sur les CDD d'usage:
description: |

View File

@ -1,5 +1,5 @@
import { History, Location } from 'history'
import { debounce } from './utils'
import { debounce, inIframe } from './utils'
declare global {
interface Window {
@ -7,17 +7,33 @@ declare global {
}
}
type PushArgs = ['trackPageView'] | ['trackEvent', ...Array<string | number>]
type TrackingAction = 'trackPageView' | 'trackEvent' | 'disableCookies'
type PushArgs = [TrackingAction, ...Array<string | number>]
type PushType = (args: PushArgs) => void
const ua = window.navigator.userAgent
const iOSSafari =
(!!ua.match(/iPad/i) || !!ua.match(/iPhone/i)) &&
!!ua.match(/WebKit/i) &&
!ua.match(/CriOS/i)
export default class Tracker {
push: PushType
unlistenFromHistory: (() => void) | undefined
previousPath: string | undefined
constructor(pushFunction: PushType = args => window._paq.push(args)) {
if (typeof window !== 'undefined') window._paq = window._paq || []
constructor(
pushFunction: PushType = args => (window?._paq ?? []).push(args)
) {
this.push = debounce(200, pushFunction) as PushType
// There is an issue with the way Safari handle cookies in iframe, cf.
// https://gist.github.com/iansltx/18caf551baaa60b79206.
// TODO : We don't need to disable cookies if a cookie is already set
if (iOSSafari && inIframe) {
pushFunction(['disableCookies'])
}
pushFunction(['trackPageView'])
}
connectToHistory(history: History) {