-
Notifications
You must be signed in to change notification settings - Fork 160
/
AmpLayout.jsx
52 lines (46 loc) · 1.11 KB
/
AmpLayout.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from 'react';
import Head from 'next/head';
import cfg from '../data/config.js';
import AmpAnalytics from './AmpAnalytics.jsx';
import AmpBoilerplate from './AmpBoilerplate.jsx';
const gtagConfig = {
vars: {
gtag_id: cfg.amp.analytics.googleTrackingId,
config: {
[cfg.amp.analytics.googleTrackingId]: {
groups: 'default',
},
},
},
};
const metrikaConfig = {
vars: {
counterId: cfg.amp.analytics.metrikaCounterId,
},
triggers: {
notBounce: {
on: 'timer',
timerSpec: {
immediate: false,
interval: 15,
maxTimerLength: 14,
},
request: 'notBounce',
},
},
};
const AmpLayout = ({ title, children }) => {
const fullTitle = title ? `${title} | ${cfg.title}` : cfg.title;
return (
<>
<Head>
<title>{fullTitle}</title>
<AmpBoilerplate />
</Head>
<AmpAnalytics type="gtag" config={gtagConfig} />
<AmpAnalytics type="metrika" config={metrikaConfig} />
<div className="markdown md:markdown-lg lg:markdown-xl">{children}</div>
</>
);
};
export default AmpLayout;