Skip to content

Commit e7070a5

Browse files
add main plugin file
1 parent 1fa4e9f commit e7070a5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

fathom-analytics.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/*
3+
Plugin Name: Fathom Analytics
4+
Description: A simple plugin to add the Fathom tracking snippet to your WordPress site.
5+
Author: Fathom Team
6+
Version: 1.0
7+
*/
8+
9+
add_action( 'wp_head', function() {
10+
?>
11+
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
12+
<script>
13+
(function(f, a, t, h, o, m){
14+
a[h]=a[h]||function(){
15+
(a[h].q=a[h].q||[]).push(arguments)
16+
};
17+
o=f.createElement('script'),
18+
o.id=h+'-script';
19+
m=f.getElementsByTagName('script')[0];
20+
o.async=1; o.src=t;
21+
m.parentNode.insertBefore(o,m)
22+
})(document, window, '//localhost:8080/tracker.js', 'fathom');
23+
fathom('trackPageview');
24+
</script>
25+
<!-- / Fathom -->
26+
<?php
27+
});

0 commit comments

Comments
 (0)