Skip to content

Commit 31f1253

Browse files
authored
add intercom and google analytics (#27)
* add intercom and google analytics * fix margin
1 parent 26e0622 commit 31f1253

File tree

9 files changed

+44
-3
lines changed

9 files changed

+44
-3
lines changed

src/css/ds-card.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
margin-top: var(--ds-space-3);
1212
}
1313

14-
.doc .ds-card .paragraph {
14+
.doc .ds-card .paragraph,
15+
.doc .ds-card .ulist .paragraph,
16+
.doc .ds-card .dlist .paragraph,
17+
.doc .ds-card .hdlist .paragraph {
1518
margin-top: var(--ds-space-2);
1619
}
1720

@@ -29,9 +32,9 @@
2932
margin-bottom: var(--ds-space-3);
3033
}
3134

32-
.ds-card .paragraph.landing-card-icon img {
35+
.ds-card .landing-card-icon .image:not(.left):not(.right) img {
3336
display: flex;
34-
margin: 0 !important;
37+
margin: 0;
3538
}
3639

3740
.ds-card .paragraph.landing-card-icon.full {

src/js/07-theme-toggle.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ toggle.onclick = function () {
1515
document.documentElement.setAttribute('data-theme', targetTheme)
1616
localStorage.setItem('theme', targetTheme)
1717
}
18+
19+
var help = document.getElementById('get-support')
20+
21+
help.onclick = function () {
22+
try {
23+
window.Intercom('show')
24+
} catch (e) {}
25+
}

src/layouts/404.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
{{> header}}
88
{{> body}}
99
{{> footer}}
10+
{{> intercom}}
1011
</body>
1112
</html>

src/layouts/default.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
{{> header}}
88
{{> body}}
99
{{> footer}}
10+
{{> intercom}}
1011
</body>
1112
</html>

src/layouts/landing.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
{{> header}}
88
{{> body}}
99
{{> footer}}
10+
{{> intercom}}
1011
</body>
1112
</html>

src/layouts/tutorial.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
{{> header}}
88
{{> body}}
99
{{> footer}}
10+
{{> intercom}}
1011
</body>
1112
</html>

src/partials/head-prelude.hbs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
<meta charset="utf-8">
22
<meta name="viewport" content="width=device-width,initial-scale=1">
3+
{{#with site.keys.googleAnalytics}}
4+
<!-- Google Tag Manager -->
5+
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
6+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
7+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
8+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
9+
})(window,document,'script','dataLayer','{{this}}');</script>
10+
<!-- End Google Tag Manager -->
11+
{{/with}}

src/partials/header-scripts.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
{{!-- Add header scripts here --}}
2+
{{#with site.keys.googleAnalytics}}
3+
<!-- Google Tag Manager (noscript) -->
4+
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{this}}"
5+
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
6+
<!-- End Google Tag Manager (noscript) -->
7+
{{/with}}

src/partials/intercom.hbs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{#with site.keys.intercom}}
2+
<script>
3+
window.intercomSettings = {
4+
app_id: "{{this}}",
5+
api_base: "https://api-iam.intercom.io"
6+
};
7+
</script>
8+
<script>
9+
!function(){var t=window,e=t.Intercom;if("function"==typeof e)e("reattach_activator"),e("update",t.intercomSettings);else{var n=document,a=function(){a.c(arguments)};a.q=[],a.c=function(t){a.q.push(t)},t.Intercom=a;var c=function(){var t=n.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://widget.intercom.io/widget/{{this}}";var e=n.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)};t.attachEvent?t.attachEvent("onload",c):t.addEventListener("load",c,!1)}}();
10+
</script>
11+
{{/with}}

0 commit comments

Comments
 (0)