Skip to content

Clarity Id is empty string in production docker image #769

@Bader-Idris

Description

@Bader-Idris

🐛 The bug

I use this approach for google tag manger id, in nuxt.config.ts file:

scripts: {
      // both in registry: {}
      googleTagManager: {
        id: process.env.GOOGLE_TAG_MANAGER_ID,
        trigger: 'onNuxtReady'
      },
}

which is working just fine with NUXT_PUBLIC_SCRIPTS_ prepended string to it as: NUXT_PUBLIC_SCRIPTS_GOOGLE_TAG_MANAGER_ID=myid

however, microsoft clarity doesn't handle the variable properly, it's always an empty string ""

clarity: {
        id: process.env.MICROSOFT_CLARITY_ID,
        partytown: true,
        trigger: 'onNuxtReady',
      },
// then built the image with NUXT_PUBLIC_SCRIPTS_MICROSOFT_CLARITY_ID=myid

I'll add the deployed website, that has the headers of both, google tag is good, microsoft clarity is empty!

🛠️ To reproduce

https://baderidris.com/

🌈 Expected behavior

to have the variable as old google ids of tag manager and analytics

ℹ️ Additional context

<script>window.__NUXT__={};window.__NUXT__.config={public:{originUrl:"https://baderidris.com",socketUrl:"wss://baderidris.com",isCapacitor:false,vapidPublicKey:"BD4xT1U3BdL8QaiNKovHpnXMRoY3EuHXsiU0vdKt4X4kFxaCzlytWVxjfgHGIR21HbK2g3AN3UtpwS2MFiRwy0Q",googleClientId:"",i18n:{baseUrl:"",defaultLocale:"en",rootRedirect:"",redirectStatusCode:302,skipSettingLocaleOnNavigate:false,locales:[{code:"en",iso:"en-US",dir:"ltr",language:"en-US",name:"English",isCatchallLocale:true},{code:"ar",iso:"ar-PS",dir:"rtl",language:"ar-PS",name:"العربية"},{code:"es",iso:"es-ES",dir:"ltr",language:"es-ES",name:"Español"}],detectBrowserLanguage:{alwaysRedirect:false,cookieCrossOrigin:false,cookieDomain:"",cookieKey:"i18n_redirected",cookieSecure:false,fallbackLocale:"",redirectOn:"root",useCookie:true},experimental:{localeDetector:"",typedPages:true,typedOptionsAndMessages:false,alternateLinkCanonicalQueries:true,devCache:false,cacheLifetime:"",stripMessagesPayload:false,preload:false,strictSeo:false,nitroContextDetection:true,httpCacheDuration:10,compactRoutes:false},domainLocales:{en:{domain:""},ar:{domain:""},es:{domain:""}}},device:{defaultUserAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.39 Safari/537.36"},skewProtection:{cookie:{name:"__nkpv",path:"/",sameSite:"lax",maxAge:604800},debug:false,connectionTracking:"",routeTracking:"",ipTracking:"",reloadStrategy:"prompt",multiTab:true,version:"1.1.1"},scripts:{googleAnalytics:{id:"G-59KJGZ93M6",scriptOptions:{partytown:true,trigger:"onNuxtReady"}},googleTagManager:{id:"GTM-W8TCSQDL",scriptOptions:{partytown:true,trigger:"onNuxtReady"}},clarity:{id:"",scriptOptions:{partytown:true,trigger:"onNuxtReady"}}},"nuxt-scripts":{version:"",prefix:"/_scripts",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:"",endpoints:{}},vgsap:{},"nuxt-seo-utils-version":"8.1.11","seo-utils":{canonicalQueryWhitelist:["page","sort","filter","search","q","category","tag"],canonicalLowercase:true,tagPriority:"low",separator:"",titleSeparator:""},mdc:{components:{prose:true,map:{},customElements:[]},headings:{anchorLinks:{h1:false,h2:true,h3:true,h4:true,h5:false,h6:false}},highlight:{noApiRoute:true,highlighter:"shiki",theme:{default:"github-light",dark:"github-dark"},shikiEngine:"oniguruma",langs:["js","jsx","json","ts","tsx","vue","css","html","bash","md","mdc","yaml"]}},content:{wsUrl:""},"nuxt-robots":{version:"6.0.8",isNuxtContentV2:false,debug:false,credits:true,groups:[{userAgent:["*"],disallow:["/contact/admin","/ar/contact/admin","/es/contact/admin"],allow:[],contentUsage:[],contentSignal:[],_indexable:true,_rules:[{pattern:"/contact/admin",allow:false},{pattern:"/ar/contact/admin",allow:false},{pattern:"/es/contact/admin",allow:false}],_normalized:true}],sitemap:["/sitemap.xml","/sitemap_index.xml","/__sitemap__/en.xml","/__sitemap__/ar.xml","/__sitemap__/es.xml","/sitemap_index.xml"],header:true,robotsEnabledValue:"index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1",robotsDisabledValue:"noindex, nofollow",cacheControl:"max-age=14400, must-revalidate",botDetection:true,pageMetaRobots:{}},"nuxt-og-image":{defaults:{emojis:"noto",extension:"png",width:1200,height:600,cacheMaxAgeSeconds:259200},hasServerRuntime:true}},app:{baseURL:"/",buildId:"7f90b046-3ead-42f8-932f-0dbf9d70ff10",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script>

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions