Tealium / tealium-kotlin

Tealium Kotlin Integration Library
Other
8 stars 11 forks source link

How to create tealium instance for custom environment #230

Open mchauhan3-wooliesx opened 9 months ago

mchauhan3-wooliesx commented 9 months ago

In our project, we have a custom tealium environment created apart from the usual(defaults) one (which is QA/PROD/DEV). However when we create a TealiumConfig object, the environment which we passes is an enum and not a string.

val config = TealiumConfig(
            application,
            configData.accountName,
            configData.profileName,
            Environment.DEV
        )

I was wondering, how we can create a TealiumConfig instance for that custom environment like say for "test".

jameskeith commented 9 months ago

Hi @mchauhan3-wooliesx Thanks for flagging this - there isn't currently support for the custom environments, and it's certainly something that we can address in a future release. Was there a specific use-case you need it for? I'm happy to raise it as a request to update on our part.

There is likely to be relevant overrides for the common modules that should allow you to control which custom environment is used. e.g. for the TagManagement dispatcher, you can specify an override for the TagManagement URL used.

config.overrideTagManagementUrl = "https://tags.tiqcdn.com/.../test/mobile.html"

One thing to note, is that the Environment is also used to distinguish the file storage locations. That is, if tested on the same device using multiple environments, there will be directories corresponding to each; each with their own visitor id, datalayer etc. Overriding just a tagmanagement url will not change that. So running a test with QA as the environment, without the tagmanagement override, would have the same visitor id/datalayer as running it with the override - I don't know if that's an issue for your specific use-case, but it's worth knowing just in case.

mchauhan3-wooliesx commented 9 months ago

Thank you for your reply @jameskeith. I will try to use overrideTagManagementUrl as you suggested to see if it covers everything for us. However, having an ability to configure it while defining TealiumConfig would be idea. Like how for iOS the environement is a String, same could be done for kotlin version too to make it easy to pass environment name. (https://github.com/Tealium/tealium-swift/blob/main/tealium/core/TealiumConfig.swift)