-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix plausible script tags and make them configurable (#105)
* Add plausible through metadata * Use Gatsby SiteMetadata for plausible domain and src * Use automatic plausible inference and relative proxy source links * Disable plausible on example * v0.1.23 * Add plausibleAPI * Re-disable plausible in example * Fix conditional plausible disable * Re-add defaults for max compatibility * Use disablePlausible flag and change mechanism to signal with src * Use pluginOptions for src/api/domain and use src presence over extra boolean flag * Allow null on plausible options * Change src to null
- Loading branch information
1 parent
b5812d2
commit 2d3096d
Showing
7 changed files
with
87 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
/* eslint-env node */ | ||
const React = require('react') | ||
|
||
const PageWrapper = require('./src/components/PageWrapper').default | ||
|
||
exports.wrapPageElement = PageWrapper | ||
|
||
const onRenderBody = ({ setHeadComponents }, { plausibleSrc }) => { | ||
if (plausibleSrc) { | ||
return setHeadComponents([ | ||
<script | ||
key="plausible-custom-events" | ||
dangerouslySetInnerHTML={{ | ||
__html: | ||
'window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }' | ||
}} | ||
/> | ||
]) | ||
} | ||
} | ||
|
||
exports.onRenderBody = onRenderBody |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters