From c288cb227dc1f7758a8fa8e670e885b85ec3ba72 Mon Sep 17 00:00:00 2001 From: Felix Date: Thu, 27 Apr 2023 16:38:27 +0200 Subject: [PATCH 1/2] Support custom CDN Host --- README.md | 3 ++- example/src/app/tealium/utag.service.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c52908a..95b560c 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,10 @@ The follow configuration settings are required and passed in to the 'setConfig' - **##TEALIUM_ACCOUNT##** (String) Tealium iQ account - **##TEALIUM_PROFILE##** (String) Tealium iQ profile - **##TEALIUM_ENVIRONMENT##** (String) Tealium iQ environment ("dev", "qa", "prod") +- **##TEALIUM_CDN##** (String) Tealium iQ CDN-URL (optional, Default value is 'https://tags.tiqcdn.com/utag/') ```javascript // The example in app.component.js shows how to configure - this.tealium.setConfig({ account: '##TEALIUM_ACCOUNT##', profile: '##TEALIUM_PROFILE##', environment: '##TEALIUM_ENVIRONMENT##' }); + this.tealium.setConfig({ account: '##TEALIUM_ACCOUNT##', profile: '##TEALIUM_PROFILE##', environment: '##TEALIUM_ENVIRONMENT##', cdn: '##TEALIUM_CDN##' }); ``` diff --git a/example/src/app/tealium/utag.service.ts b/example/src/app/tealium/utag.service.ts index a76dbee..1bfa505 100644 --- a/example/src/app/tealium/utag.service.ts +++ b/example/src/app/tealium/utag.service.ts @@ -37,9 +37,9 @@ export class TealiumUtagService { } // Config settings used to build the path to the utag.js file - setConfig(config: {account: string, profile: string, environment: string}) { + setConfig(config: {account: string, profile: string, environment: string, cdn: string = 'https://tags.tiqcdn.com/utag/'}) { if ( config.account !== undefined && config.profile !== undefined && config.environment !== undefined ) { - this.scriptSrc = 'https://tags.tiqcdn.com/utag/' + config.account + '/' + config.profile + '/' + config.environment + '/utag.js'; + this.scriptSrc = config.cdn + config.account + '/' + config.profile + '/' + config.environment + '/utag.js'; } } From 812e39ec9c20c465fd35940821280cdb30e5ab97 Mon Sep 17 00:00:00 2001 From: Felix Date: Thu, 27 Apr 2023 16:49:59 +0200 Subject: [PATCH 2/2] Use questionmark-notation --- example/src/app/tealium/utag.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/src/app/tealium/utag.service.ts b/example/src/app/tealium/utag.service.ts index 1bfa505..f17779e 100644 --- a/example/src/app/tealium/utag.service.ts +++ b/example/src/app/tealium/utag.service.ts @@ -37,7 +37,8 @@ export class TealiumUtagService { } // Config settings used to build the path to the utag.js file - setConfig(config: {account: string, profile: string, environment: string, cdn: string = 'https://tags.tiqcdn.com/utag/'}) { + setConfig(config: {account: string, profile: string, environment: string, cdn?: string}) { + config.cdn = config.cdn || 'https://tags.tiqcdn.com/utag/'; if ( config.account !== undefined && config.profile !== undefined && config.environment !== undefined ) { this.scriptSrc = config.cdn + config.account + '/' + config.profile + '/' + config.environment + '/utag.js'; }