2 approachs for this
- first: use nuxt
head()
in nuxt-page-component (recommended)
export default{
head(){
return {
script: [
{
type:'text/javascript',
innerHTML: `/* To enable Participant Auto Authentication, uncomment this code below (https://docs.growsurf.com/getting-started/participant-auto-authentication) */
/*
window.grsfConfig = {
email: "[email protected]",// Replace this with the participant's email address
hash: "HASH_VALUE" // Replace this with the SHA-256 HMAC value
};
*/
(function(g,r,s,f){g.grsfSettings={campaignId:"mpw47p",version:"2.0.0"};s=r.getElementsByTagName("head")[0];f=r.createElement("script");f.async=1;f.src="https://app.growsurf.com/growsurf.js"+"?v="+g.grsfSettings.version;f.setAttribute("grsf-campaign", g.grsfSettings.campaignId);!g.grsfInit?s.appendChild(f):"";})(window,document);`
}
]
}
}
}
in nuxt.config.js
:
module.exports = {
head: {
script: [
{
type:'text/javascript',
innerHTML: `/* To enable Participant Auto Authentication, uncomment this code below (https://docs.growsurf.com/getting-started/participant-auto-authentication) */
/*
window.grsfConfig = {
email: "[email protected]",// Replace this with the participant's email address
hash: "HASH_VALUE" // Replace this with the SHA-256 HMAC value
};
*/
(function(g,r,s,f){g.grsfSettings={campaignId:"mpw47p",version:"2.0.0"};s=r.getElementsByTagName("head")[0];f=r.createElement("script");f.async=1;f.src="https://app.growsurf.com/growsurf.js"+"?v="+g.grsfSettings.version;f.setAttribute("grsf-campaign", g.grsfSettings.campaignId);!g.grsfInit?s.appendChild(f):"";})(window,document);`
}
]
}
};
here is what you get
- second: custom
index.html
<!DOCTYPE html>
<html {{ HTML_ATTRS }}>
<head {{ HEAD_ATTRS }}>
{{ HEAD }}
<script type="text/javascript">
/* To enable Participant Auto Authentication, uncomment this code below (https://docs.growsurf.com/getting-started/participant-auto-authentication) */
/*
window.grsfConfig = {
email: "[email protected]",// Replace this with the participant's email address
hash: "HASH_VALUE" // Replace this with the SHA-256 HMAC value
};
*/
(function(g,r,s,f){g.grsfSettings={campaignId:"mpw47p",version:"2.0.0"};s=r.getElementsByTagName("head")[0];f=r.createElement("script");f.async=1;f.src="https://app.growsurf.com/growsurf.js"+"?v="+g.grsfSettings.version;f.setAttribute("grsf-campaign", g.grsfSettings.campaignId);!g.grsfInit?s.appendChild(f):"";})(window,document);
</script>
</head>
<body {{ BODY_ATTRS }}>
{{ APP }}
</body>
</html>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…