WIP - add extractor, generate snippet_data

This commit is contained in:
Stefan Fejes
2019-08-20 15:52:05 +02:00
parent 88084d3d30
commit cc8f1d8a7a
37396 changed files with 4588842 additions and 133 deletions

6
node_modules/gatsby-plugin-google-analytics/.babelrc generated vendored Normal file
View File

@ -0,0 +1,6 @@
{
"presets": [
["babel-preset-gatsby-package", { "browser": true }]
]
}

View File

@ -0,0 +1,192 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.1.7](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.1.6...gatsby-plugin-google-analytics@2.1.7) (2019-08-06)
**Note:** Version bump only for package gatsby-plugin-google-analytics
## [2.1.6](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.1.5...gatsby-plugin-google-analytics@2.1.6) (2019-07-30)
### Bug Fixes
- **gatsby-plugin-google-analytics:** Fix broken script ([#16223](https://github.com/gatsbyjs/gatsby/issues/16223)) ([4ff5321](https://github.com/gatsbyjs/gatsby/commit/4ff5321))
## [2.1.5](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.1.4...gatsby-plugin-google-analytics@2.1.5) (2019-07-30)
### Features
- **gatsby-plugin-google-analytics:** enable more options. ([#15280](https://github.com/gatsbyjs/gatsby/issues/15280)) ([b3ed9be](https://github.com/gatsbyjs/gatsby/commit/b3ed9be))
## [2.1.4](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.1.3...gatsby-plugin-google-analytics@2.1.4) (2019-07-12)
**Note:** Version bump only for package gatsby-plugin-google-analytics
## [2.1.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.1.2...gatsby-plugin-google-analytics@2.1.3) (2019-07-12)
### Bug Fixes
- correct links in package changelogs ([#15630](https://github.com/gatsbyjs/gatsby/issues/15630)) ([d07b9dd](https://github.com/gatsbyjs/gatsby/commit/d07b9dd))
### Features
- **gatsby-plugin-google-analytics:** Add pageTransitionDelay… ([#15610](https://github.com/gatsbyjs/gatsby/issues/15610)) ([d652496](https://github.com/gatsbyjs/gatsby/commit/d652496))
## [2.1.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.1.1...gatsby-plugin-google-analytics@2.1.2) (2019-07-11)
**Note:** Version bump only for package gatsby-plugin-google-analytics
## [2.1.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.1.0...gatsby-plugin-google-analytics@2.1.1) (2019-06-27)
**Note:** Version bump only for package gatsby-plugin-google-analytics
# [2.1.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.21...gatsby-plugin-google-analytics@2.1.0) (2019-06-20)
**Note:** Version bump only for package gatsby-plugin-google-analytics
## [2.0.21](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.20...gatsby-plugin-google-analytics@2.0.21) (2019-06-10)
### Bug Fixes
- **gatsby-plugin-google-analytics:** Refactor gatsby-plugin-google-analytics gatsby-browser.js ([#14572](https://github.com/gatsbyjs/gatsby/issues/14572)) ([9f2c0c9](https://github.com/gatsbyjs/gatsby/commit/9f2c0c9))
## [2.0.20](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.19...gatsby-plugin-google-analytics@2.0.20) (2019-05-14)
**Note:** Version bump only for package gatsby-plugin-google-analytics
## [2.0.19](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.18...gatsby-plugin-google-analytics@2.0.19) (2019-04-30)
**Note:** Version bump only for package gatsby-plugin-google-analytics
## [2.0.18](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.17...gatsby-plugin-google-analytics@2.0.18) (2019-03-26)
### Features
- **gatsby-plugin-google-analytics:** Add preconnect and dns-prefetch ([#12826](https://github.com/gatsbyjs/gatsby/issues/12826)) ([0640104](https://github.com/gatsbyjs/gatsby/commit/0640104))
## [2.0.17](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.16...gatsby-plugin-google-analytics@2.0.17) (2019-03-11)
**Note:** Version bump only for package gatsby-plugin-google-analytics
## [2.0.16](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.15...gatsby-plugin-google-analytics@2.0.16) (2019-03-04)
**Note:** Version bump only for package gatsby-plugin-google-analytics
## [2.0.15](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.14...gatsby-plugin-google-analytics@2.0.15) (2019-02-28)
**Note:** Version bump only for package gatsby-plugin-google-analytics
## [2.0.14](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.13...gatsby-plugin-google-analytics@2.0.14) (2019-02-15)
### Bug Fixes
- **google-analytics:** fix pageview timing issue by delaying it ([#10917](https://github.com/gatsbyjs/gatsby/issues/10917)) ([42f509e](https://github.com/gatsbyjs/gatsby/commit/42f509e)), closes [#9139](https://github.com/gatsbyjs/gatsby/issues/9139) [#2478](https://github.com/gatsbyjs/gatsby/issues/2478) [#3362](https://github.com/gatsbyjs/gatsby/issues/3362)
## [2.0.13](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.12...gatsby-plugin-google-analytics@2.0.13) (2019-02-01)
**Note:** Version bump only for package gatsby-plugin-google-analytics
## [2.0.12](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.11...gatsby-plugin-google-analytics@2.0.12) (2019-01-28)
### Features
- **gatsby-plugin-google-analytics:** add TS typings for OutboundLink component ([#10215](https://github.com/gatsbyjs/gatsby/issues/10215)) ([7fee096](https://github.com/gatsbyjs/gatsby/commit/7fee096))
## [2.0.11](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.10...gatsby-plugin-google-analytics@2.0.11) (2019-01-28)
### Features
- **gatsby-plugin-google-analytics:** Pass event object to the user's onClick callback in OutboundLink ([#11340](https://github.com/gatsbyjs/gatsby/issues/11340)) ([e81b246](https://github.com/gatsbyjs/gatsby/commit/e81b246))
<a name="2.0.10"></a>
## [2.0.10](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.9...gatsby-plugin-google-analytics@2.0.10) (2019-01-23)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.9"></a>
## [2.0.9](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.8...gatsby-plugin-google-analytics@2.0.9) (2019-01-08)
### Features
- **gatsby-plugin-google-analytics:** add support for google optimize experiment and variation id ([#10903](https://github.com/gatsbyjs/gatsby/issues/10903)) ([45ec012](https://github.com/gatsbyjs/gatsby/commit/45ec012))
<a name="2.0.8"></a>
## [2.0.8](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.7...gatsby-plugin-google-analytics@2.0.8) (2018-11-29)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.7"></a>
## [2.0.7](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.6...gatsby-plugin-google-analytics@2.0.7) (2018-10-29)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.6"></a>
## [2.0.6](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.5...gatsby-plugin-google-analytics@2.0.6) (2018-09-18)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.5"></a>
## [2.0.5](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.0-rc.2...gatsby-plugin-google-analytics@2.0.5) (2018-09-17)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.0-rc.2"></a>
# [2.0.0-rc.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.0-rc.1...gatsby-plugin-google-analytics@2.0.0-rc.2) (2018-09-07)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.0-rc.1"></a>
# [2.0.0-rc.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.0-rc.0...gatsby-plugin-google-analytics@2.0.0-rc.1) (2018-08-29)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.0-rc.0"></a>
# [2.0.0-rc.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.0-beta.5...gatsby-plugin-google-analytics@2.0.0-rc.0) (2018-08-21)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.0-beta.5"></a>
# [2.0.0-beta.5](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.0-beta.4...gatsby-plugin-google-analytics@2.0.0-beta.5) (2018-08-08)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.0-beta.4"></a>
# [2.0.0-beta.4](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.0-beta.3...gatsby-plugin-google-analytics@2.0.0-beta.4) (2018-08-06)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.0-beta.3"></a>
# [2.0.0-beta.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.0-beta.2...gatsby-plugin-google-analytics@2.0.0-beta.3) (2018-07-21)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.0-beta.2"></a>
# [2.0.0-beta.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.0-beta.1...gatsby-plugin-google-analytics@2.0.0-beta.2) (2018-06-20)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.0-beta.1"></a>
# [2.0.0-beta.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@2.0.0-beta.0...gatsby-plugin-google-analytics@2.0.0-beta.1) (2018-06-17)
**Note:** Version bump only for package gatsby-plugin-google-analytics
<a name="2.0.0-beta.0"></a>
# [2.0.0-beta.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-plugin-google-analytics@1.0.31...gatsby-plugin-google-analytics@2.0.0-beta.0) (2018-06-17)
**Note:** Version bump only for package gatsby-plugin-google-analytics

22
node_modules/gatsby-plugin-google-analytics/LICENSE generated vendored Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Gatsbyjs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

149
node_modules/gatsby-plugin-google-analytics/README.md generated vendored Normal file
View File

@ -0,0 +1,149 @@
# gatsby-plugin-google-analytics
Easily add Google Analytics to your Gatsby site.
## Install
`npm install --save gatsby-plugin-google-analytics`
## How to use
```javascript
// In your gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: "YOUR_GOOGLE_ANALYTICS_TRACKING_ID",
// Defines where to place the tracking script - `true` in the head and `false` in the body
head: false,
// Setting this parameter is optional
anonymize: true,
// Setting this parameter is also optional
respectDNT: true,
// Avoids sending pageview hits from custom paths
exclude: ["/preview/**", "/do-not-track/me/too/"],
// Delays sending pageview hits on route update (in milliseconds)
pageTransitionDelay: 0,
// Enables Google Optimize using your container Id
optimizeId: "YOUR_GOOGLE_OPTIMIZE_TRACKING_ID",
// Enables Google Optimize Experiment ID
experimentId: "YOUR_GOOGLE_EXPERIMENT_ID",
// Set Variation ID. 0 for original 1,2,3....
variationId: "YOUR_GOOGLE_OPTIMIZE_VARIATION_ID",
// Any additional optional fields
sampleRate: 5,
siteSpeedSampleRate: 10,
cookieDomain: "example.com",
},
},
],
}
```
See below for the complete list of [optional fields](#optional-fields).
## `<OutboundLink>` component
To make it easy to track clicks on outbound links in Google Analytics,
the plugin provides a component.
To use it, simply import it and use it like you would the `<a>` element e.g.
```jsx
import React
import { OutboundLink } from 'gatsby-plugin-google-analytics'
export default () => {
<div>
<OutboundLink
href="https://www.gatsbyjs.org/packages/gatsby-plugin-google-analytics/"
>
Visit the Google Analytics plugin page!
</OutboundLink>
</div>
}
```
## Options
### `trackingId`
Here you place your Google Analytics tracking id.
### `head`
Where do you want to place the GA script? By putting `head` to `true`, it will be placed in the "<head>" of your website. By setting it to `false`, it will be placed in the "<body>". The default value resolves to `false`.
### `anonymize`
Some countries (such as Germany) require you to use the
[\_anonymizeIP](https://support.google.com/analytics/answer/2763052) function for
Google Analytics. Otherwise you are not allowed to use it. The option adds two
blocks to the code:
```javascript
function gaOptout(){document.cookie=disableStr+'=true; expires=Thu, 31 Dec 2099 23:59:59 UTC;path=/',window[disableStr]=!0}var gaProperty='UA-XXXXXXXX-X',disableStr='ga-disable-'+gaProperty;document.cookie.indexOf(disableStr+'=true')>-1&&(window[disableStr]=!0);
...
ga('set', 'anonymizeIp', 1);
```
If your visitors should be able to set an Opt-Out-Cookie (No future tracking)
you can set a link e.g. in your imprint as follows:
`<a href="javascript:gaOptout();">Deactivate Google Analytics</a>`
### `respectDNT`
If you enable this optional option, Google Analytics will not be loaded at all for visitors that have "Do Not Track" enabled. While using Google Analytics does not necessarily constitute Tracking, you might still want to do this to cater to more privacy oriented users.
### `exclude`
If you need to exclude any path from the tracking system, you can add it (one or more) to this optional array as glob expressions.
### `pageTransitionDelay`
If your site uses any custom transitions on route update (e.g. [`gatsby-plugin-transition-link`](https://www.gatsbyjs.org/blog/2018-12-04-per-link-gatsby-page-transitions-with-transitionlink/)), then you can delay processing the page view event until the new page is mounted.
### `optimizeId`
If you need to use Google Optimize for A/B testing, you can add this optional Optimize container id to allow Google Optimize to load the correct test parameters for your site.
### `experimentId`
If you need to set up SERVER_SIDE Google Optimize experiment, you can add the experiment ID. The experiment ID is shown on the right-hand panel on the experiment details page. [Server-side Experiments](https://developers.google.com/optimize/devguides/experiments)
### `variationId`
Besides the experiment ID you also need the variation ID for SERVER_SIDE experiments in Google Optimize. Set 0 for original version.
## Optional Fields
This plugin supports all optional Create Only Fields documented in [Google Analytics](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#create):
- `name`: string, tracker name
- `clientId`: string
- `sampleRate`: number
- `siteSpeedSampleRate`: number
- `alwaysSendReferrer`: boolean
- `allowAnchor`: boolean
- `cookieName`: string
- `cookieDomain`: string, defaults to `'auto'` if not given
- `cookieExpires`: number
- `storeGac`: boolean
- `legacyCookieDomain`: string
- `legacyHistoryImport`: boolean
- `allowLinker`: boolean
This plugin also supports several optional General fields documented in [Google Analytics](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#general):
- `allowAdFeatures`: boolean
- `dataSource`: string
- `queueTime`: number
- `forceSSL`: boolean
- `transport`: string
These fields can be specified in the plugin's `options` as shown in the [How to use](#how-to-use) section.

View File

@ -0,0 +1,35 @@
"use strict";
exports.__esModule = true;
exports.onRouteUpdate = void 0;
var onRouteUpdate = function onRouteUpdate(_ref, pluginOptions) {
var location = _ref.location;
if (pluginOptions === void 0) {
pluginOptions = {};
}
if (process.env.NODE_ENV !== "production" || typeof ga !== "function") {
return null;
}
var pathIsExcluded = location && typeof window.excludeGAPaths !== "undefined" && window.excludeGAPaths.some(function (rx) {
return rx.test(location.pathname);
});
if (pathIsExcluded) return null; // wrap inside a timeout to make sure react-helmet is done with it's changes (https://github.com/gatsbyjs/gatsby/issues/9139)
// reactHelmet is using requestAnimationFrame: https://github.com/nfl/react-helmet/blob/5.2.0/src/HelmetUtils.js#L296-L299
var sendPageView = function sendPageView() {
var pagePath = location ? location.pathname + location.search + location.hash : undefined;
window.ga("set", "page", pagePath);
window.ga("send", "pageview");
}; // Minimum delay for reactHelmet's requestAnimationFrame
var delay = Math.max(32, pluginOptions.pageTransitionDelay || 0);
setTimeout(sendPageView, delay);
return null;
};
exports.onRouteUpdate = onRouteUpdate;

View File

@ -0,0 +1,81 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.onRenderBody = void 0;
var _react = _interopRequireDefault(require("react"));
var knownOptions = {
createOnly: {
clientId: "string",
sampleRate: "number",
siteSpeedSampleRate: "number",
alwaysSendReferrer: "boolean",
allowAnchor: "boolean",
cookieName: "string",
cookieExpires: "number",
storeGac: "boolean",
legacyCookieDomain: "string",
legacyHistoryImport: "boolean",
allowLinker: "boolean"
},
general: {
allowAdFeatures: "boolean",
dataSource: "string",
queueTime: "number",
forceSSL: "boolean",
transport: "string"
}
};
var onRenderBody = function onRenderBody(_ref, pluginOptions) {
var setHeadComponents = _ref.setHeadComponents,
setPostBodyComponents = _ref.setPostBodyComponents;
if (process.env.NODE_ENV !== "production") {
return null;
} // Lighthouse recommends pre-connecting to google analytics
setHeadComponents([_react.default.createElement("link", {
rel: "preconnect dns-prefetch",
key: "preconnect-google-analytics",
href: "https://www.google-analytics.com"
})]);
var excludeGAPaths = [];
if (typeof pluginOptions.exclude !== "undefined") {
var Minimatch = require("minimatch").Minimatch;
pluginOptions.exclude.map(function (exclude) {
var mm = new Minimatch(exclude);
excludeGAPaths.push(mm.makeRe());
});
}
var gaCreateOptions = {};
for (var option in knownOptions.createOnly) {
if (typeof pluginOptions[option] === knownOptions.createOnly[option]) {
gaCreateOptions[option] = pluginOptions[option];
}
}
var setComponents = pluginOptions.head ? setHeadComponents : setPostBodyComponents;
return setComponents([_react.default.createElement("script", {
key: "gatsby-plugin-google-analytics",
dangerouslySetInnerHTML: {
__html: "\n " + (excludeGAPaths.length ? "window.excludeGAPaths=[" + excludeGAPaths.join(",") + "];" : "") + "\n " + (typeof pluginOptions.anonymize !== "undefined" && pluginOptions.anonymize === true ? "function gaOptout(){document.cookie=disableStr+'=true; expires=Thu, 31 Dec 2099 23:59:59 UTC;path=/',window[disableStr]=!0}var gaProperty='" + pluginOptions.trackingId + "',disableStr='ga-disable-'+gaProperty;document.cookie.indexOf(disableStr+'=true')>-1&&(window[disableStr]=!0);" : "") + "\n if(" + (typeof pluginOptions.respectDNT !== "undefined" && pluginOptions.respectDNT == true ? "!(navigator.doNotTrack == \"1\" || window.doNotTrack == \"1\")" : "true") + ") {\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\n }\n if (typeof ga === \"function\") {\n ga('create', '" + pluginOptions.trackingId + "', '" + (typeof pluginOptions.cookieDomain === "string" ? pluginOptions.cookieDomain : "auto") + "', " + (typeof pluginOptions.name === "string" ? "'" + pluginOptions.name + "', " : "") + JSON.stringify(gaCreateOptions) + ");\n " + (typeof pluginOptions.anonymize !== "undefined" && pluginOptions.anonymize === true ? "ga('set', 'anonymizeIp', true);" : "") + "\n " + (typeof pluginOptions.optimizeId !== "undefined" ? "ga('require', '" + pluginOptions.optimizeId + "');" : "") + "\n " + (typeof pluginOptions.experimentId !== "undefined" ? "ga('set', 'expId', '" + pluginOptions.experimentId + "');" : "") + "\n " + (typeof pluginOptions.variationId !== "undefined" ? "ga('set', 'expVar', '" + pluginOptions.variationId + "');" : "") + "\n " + Object.keys(knownOptions.general).reduce(function (gaSetCommands, option) {
if (typeof pluginOptions[option] === knownOptions.general[option]) {
gaSetCommands += "ga('set', '" + option + "', '" + pluginOptions[option] + "');\n";
}
return gaSetCommands;
}, "") + "\n }"
}
})]);
};
exports.onRenderBody = onRenderBody;

10
node_modules/gatsby-plugin-google-analytics/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,10 @@
import * as React from "react"
interface OutboundLinkProps {
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void
}
export class OutboundLink extends React.Component<
OutboundLinkProps & React.HTMLProps<HTMLAnchorElement>,
any
> {}

58
node_modules/gatsby-plugin-google-analytics/index.js generated vendored Normal file
View File

@ -0,0 +1,58 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.OutboundLink = OutboundLink;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
function OutboundLink(props) {
return _react.default.createElement("a", (0, _extends2.default)({}, props, {
onClick: function onClick(e) {
if (typeof props.onClick === "function") {
props.onClick(e);
}
var redirect = true;
if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.defaultPrevented) {
redirect = false;
}
if (props.target && props.target.toLowerCase() !== "_self") {
redirect = false;
}
if (window.ga) {
window.ga("send", "event", {
eventCategory: "Outbound Link",
eventAction: "click",
eventLabel: props.href,
transport: redirect ? "beacon" : "",
hitCallback: function hitCallback() {
if (redirect) {
document.location = props.href;
}
}
});
} else {
if (redirect) {
document.location = props.href;
}
}
return false;
}
}));
}
OutboundLink.propTypes = {
href: _propTypes.default.string,
target: _propTypes.default.string,
onClick: _propTypes.default.func
};

View File

@ -0,0 +1,74 @@
{
"_from": "gatsby-plugin-google-analytics@^2.1.6",
"_id": "gatsby-plugin-google-analytics@2.1.7",
"_inBundle": false,
"_integrity": "sha512-fqIWS+uIXqwFg+wRkFuy1xjB7B8a6xKkNEB94j9ujWUwqlS9wcMv2E332+mNfI4Ql2J6pwrjwTBaUhM42Br1eg==",
"_location": "/gatsby-plugin-google-analytics",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "gatsby-plugin-google-analytics@^2.1.6",
"name": "gatsby-plugin-google-analytics",
"escapedName": "gatsby-plugin-google-analytics",
"rawSpec": "^2.1.6",
"saveSpec": null,
"fetchSpec": "^2.1.6"
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "https://registry.npmjs.org/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-2.1.7.tgz",
"_shasum": "f4511a94ac8d37103699dbe582f6a5ac9ab91a36",
"_spec": "gatsby-plugin-google-analytics@^2.1.6",
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code",
"author": {
"name": "Kyle Mathews",
"email": "mathews.kyle@gmail.com"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/runtime": "^7.0.0"
},
"deprecated": false,
"description": "Gatsby plugin to add google analytics onto a site",
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@testing-library/react": "^8.0.1",
"babel-preset-gatsby-package": "^0.2.2",
"cross-env": "^5.1.4"
},
"engines": {
"node": ">=8.0.0"
},
"gitHead": "c1960a260d3fbd5b6f57fb29317693d45a0686d3",
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-google-analytics#readme",
"keywords": [
"gatsby",
"gatsby-plugin",
"google analytics"
],
"license": "MIT",
"main": "index.js",
"name": "gatsby-plugin-google-analytics",
"peerDependencies": {
"gatsby": "^2.0.0",
"react": "^16.4.2",
"react-dom": "^16.4.2"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gatsbyjs/gatsby.git",
"directory": "packages/gatsby-plugin-google-analytics"
},
"scripts": {
"build": "babel src --out-dir . --ignore **/__tests__",
"prepare": "cross-env NODE_ENV=production npm run build",
"watch": "babel -w src --out-dir . --ignore **/__tests__"
},
"version": "2.1.7"
}