Browse Source

Add Google Analytics in AMP

master
angristan 10 months ago
parent
commit
9315aa74db
2 changed files with 19 additions and 1 deletions
  1. +1
    -1
      README.md
  2. +18
    -0
      amp.hbs

+ 1
- 1
README.md View File

@@ -23,7 +23,7 @@ List of the modifications made in this fork:
* Added [GitLab CI](https://gitlab.com/angristan/Casper-XYZ/pipelines)
* [Use GitLab-like font for code blocks instead of ugly monospace](https://github.com/angristan/Casper-XYZ/blob/master/assets/css/custom.css#L163)
* [Replaced estimated reading time on posts list by the release date](https://github.com/angristan/Casper-XYZ/pull/4)
* [Backported AMP template to theme for customisation](https://github.com/angristan/Casper-XYZ/blob/master/amp.hbs)
* [Backported AMP template to theme for customisation (Google Analytics)](https://github.com/angristan/Casper-XYZ/blob/master/amp.hbs)

### Hardcoded stuff



+ 18
- 0
amp.hbs View File

@@ -22,11 +22,29 @@
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>

{{!-- Load amp-analytics --}}
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>

{{amp_components}}

</head>

<body class="amp-template">

{{!-- Configure analytics to use gtag --}}
<amp-analytics type="gtag" data-credentials="include">
<script type="application/json">
{
"vars" : {
"gtag_id": "UA-138727688-1",
"config" : {
"UA-138727688-1": { "groups": "default" }
}
}
}
</script>
</amp-analytics>

{{#post}}
<header class="main-header">
<nav class="blog-title">


Loading…
Cancel
Save