Skip to content

Commit ade3e72

Browse files
patmellonbrsoff
authored andcommitted
[PYT-248-a] Add pixel and analytics code snippets (pytorch#82)
1 parent 1f79731 commit ade3e72

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ build: install include-yarn-deps
4444
rm -rf _site/scripts
4545

4646
serve: install include-yarn-deps
47-
JEKYLL_ENV=production $(JEKYLL) serve --config _config.yml,_config_dev.yml
47+
JEKYLL_ENV=development $(JEKYLL) serve --config _config.yml,_config_dev.yml
4848

4949
build_deploy: include-yarn-deps
50-
$(JEKYLL) build
50+
JEKYLL_ENV=production $(JEKYLL) build
5151
rm _site/Gemfile
5252
rm _site/Gemfile.lock
5353
rm _site/Makefile

_includes/analytics.html

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-125653540-1"></script>
2+
<script>
3+
window.dataLayer = window.dataLayer || [];
4+
function gtag(){dataLayer.push(arguments);}
5+
gtag('js', new Date());
6+
gtag('config', 'UA-125653540-1');
7+
</script>

_includes/head.html

+4
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@
1515
<script src="{{ site.baseurl }}/assets/vendor/popper.min.js"></script>
1616
<script src="{{ site.baseurl }}/assets/vendor/bootstrap.min.js"></script>
1717
<script src="{{ site.baseurl }}/assets/vendor/anchor.min.js"></script>
18+
{% if jekyll.environment == 'production' %}
19+
{% include analytics.html %}
20+
{% include pixel.html %}
21+
{% endif %}
1822
</head>

_includes/pixel.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script>
2+
!function(f,b,e,v,n,t,s)
3+
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
4+
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
5+
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
6+
n.queue=[];t=b.createElement(e);t.async=!0;
7+
t.src=v;s=b.getElementsByTagName(e)[0];
8+
s.parentNode.insertBefore(t,s)}(window,document,'script',
9+
'https://connect.facebook.net/en_US/fbevents.js');
10+
fbq('init', '243028289693773');
11+
fbq('track', 'PageView');
12+
</script>
13+
<noscript>
14+
<img height="1" width="1"
15+
src="https://www.facebook.com/tr?id=243028289693773&ev=PageView
16+
&noscript=1"/>
17+
</noscript>

0 commit comments

Comments
 (0)