Skip to content

Commit

Permalink
perf(v2): add link rel preconnect for google analytics & google tags …
Browse files Browse the repository at this point in the history
…plugin (#2062)
  • Loading branch information
endiliey committed Nov 30, 2019
1 parent 3559a11 commit 690de07
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/docusaurus-plugin-google-analytics/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,19 @@ module.exports = function() {
getClientModules() {
return [path.resolve(__dirname, './analytics')];
},

injectHtmlTags() {
return {
headTags: [
{
tagName: 'link',
attributes: {
rel: 'preconnect',
href: 'https://www.google-analytics.com',
},
},
],
};
},
};
};
21 changes: 21 additions & 0 deletions packages/docusaurus-plugin-google-gtag/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,26 @@ module.exports = function() {
getClientModules() {
return [path.resolve(__dirname, './gtag')];
},

injectHtmlTags() {
return {
headTags: [
{
tagName: 'link',
attributes: {
rel: 'preconnect',
href: 'https://www.google-analytics.com',
},
},
{
tagName: 'link',
attributes: {
rel: 'preconnect',
href: 'https://www.googletagmanager.com',
},
},
],
};
},
};
};

0 comments on commit 690de07

Please sign in to comment.