Skip to content

Commit eaabcc0

Browse files
committed
fix: Readded kentico tracking header
1 parent d534e0b commit eaabcc0

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/runtime/plugin.template.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { NuxtDeliveryClient } from '~deliveryclientruntime/NuxtDeliveryClient'
44
// Default configuration
55
let config = {
66
kenticokontent: {
7-
projectId: ''
7+
projectId: '',
8+
globalQueryConfig: {}
89
}
910
}
1011

@@ -38,8 +39,27 @@ declare module 'vuex/types/index' {
3839
}
3940

4041
const deliveryClientPlugin: Plugin = (context, inject) => {
41-
const deliveryClient = new NuxtDeliveryClient(config.kenticokontent);
42+
var kcSourceHeader = { header: 'X-KC-SOURCE', value: 'kentico-kontent-nuxt-module' };
4243

44+
if(config.kenticokontent.globalQueryConfig){
45+
config.kenticokontent.globalQueryConfig = Object.assign({}, config.kenticokontent.globalQueryConfig, {
46+
customHeaders: [
47+
kcSourceHeader
48+
]
49+
});
50+
}
51+
else{
52+
config.kenticokontent = Object.assign({}, config.kenticokontent, {
53+
globalQueryConfig: {
54+
customHeaders: [
55+
kcSourceHeader
56+
]
57+
}
58+
});
59+
}
60+
61+
const deliveryClient = new NuxtDeliveryClient(config.kenticokontent);
62+
4363
inject('deliveryclient', deliveryClient)
4464
}
4565

0 commit comments

Comments
 (0)