How to correctly setup Library Architecture?

Rookie Contributor

I'm having some issues setting up our project spanning over multiple sites with multiple optional libraries.

We have a website being released in multiple markets.
Each site has its own Tealium Profile.
Each profile can have one or multiple tags and extensions (e.g. SiteCatalyst, Google Analytics, Webtrekk, etc).

We have one overall Data Layer that's connected with our website code. These variables are used in all different tags and extensions.
So we created a library for all our generic Data Sources that gets included in all our site profiles, so we can keep track of them in one place.

We also created a library for each individual Tracking Tag. Here we added the tag with default configuration and mappings, together with the related extensions.

However, the tags' mapped data sources and extensions need access to the Data Sources defined in the other library. But it cannot access them.

As far as I can see there are two options:

1. Copy all (needed) data sources in all tag-libraries that need them.
I don't like this solution because now the data sources are duplicated all over different libraries, and it duplicates the amount of work needed when we introduce new data sources.

2. Don't use libraries for tags/extensions and configure them in the site profile where you can access the Data Sources from the included library.
I don't like this either because it you cannot use the benefit of pre-configured tags and extensions, so you need to copy them over from a previous site, or write them down somewhere else.
Also, updates normally done in a library that propagate to all profiles, now have to be done manually in every profile for the same tag, which involves a lot of work.

It would be better of a library could import another library that it needs to make use of, but that doesn't seem possible right now.

Am I missing something here, or is this indeed not possible in a normal way without reverting to a cumbersome workaround?


How to correctly setup Library Architecture?

Employee Emeritus

Hi Arjan,

Apologies for the delay - I see your dilemma. I have used libraries extensively and in particular on one client across dozens of profiles.

I would propose a third option where you house all of the tags (at least the tags that will be used on more than one profile) in the single library profile (the one with the data sources) and then use load rules in the library to configure where those tags should fire.

Let's take an example:

- You want have 10 profiles and 2 tags.
- You want tag A to fire on profiles 1-5
- You want tag B to fire on profiles 6-10

You can have the single library running across all profiles but then set a load rule in the library against tag A to fire on profiles 1-5 and then a load rule in the library against tag B to fire on profiles 6-10.

Note: The load rule would either check the domain or something else in the data layer to decide whether to fire (e.g. 'site_name' etc)

You could have another variant of this which would be to have a load rule against the tag which would check for a new data source (e.g. 'tag_flags') to fire if 'tag_flags' contains 'tag_a' or 'tag_b':

screenshot (

Then, in the profile you could have a javascript extension scoped as a 'pre-loader' which sets 'utag_data.tag_flags' to 'tag_a,tag_b'. Here is some sample code:

window.utag_data = window.utag_data || {};
utag_data.tag_flags = 'tag_a,tag_b,tag_c';

screenie (
Note: It needs to be scoped to 'pre-loader' as load rules run before extensions are run unless the extension is scoped to 'pre-loader'
This way, you wouldn't ever need to update the load rules to fire it on a particular new profile - you could just use the above extension in the child profile to ensure the tags you want fire.

Note: you can avoid using a pre-loader-scoped extension (i.e. just use any normal extension scoped to 'all tags' to set the value of 'tag_flags') if you use the 'load_rules_at_wait' functionality (

screenie (
Let me know what you think!



How to correctly setup Library Architecture?

Rookie Contributor

Hi Roshan,

Thank you for the extensive explanation!
This is indeed a valid third option, but sadly enough still a compromise with its own downsides.

As new profiles and tags are created along the way there is no way to determine if a tag will be used in one or multiple profiles, so it's hard to decide where to place them; in an own library of in the generic library.

To correctly make use of the Data Sources in the tags you are almost required to put all of the tags in the general library, but that will in turn bloat all the profiles with tags they are not using (with tag-related data sources and extensions).

I think I will stick with option 1 at the moment, as it is the least amount of work and overhead, while still keeping all tag-libraries separated.

But other might choose other options based on their use cases and personal opinion.

How to correctly setup Library Architecture?

Employee Emeritus
  • Hi Arjan,

    No problem. I see. When you set a new tag you don't know if it's going to be re-used or not?

    Yes, that's a challenge I faced too. With Web Analytics it's quite likely so as long as you have the same mappings each time then you could add this to the library straight away.

    For the tags that you're not sure if you're going to add more than once, I guess you'd have to make an educated guess and add it to the library if you think it'll be used again.

    You can use extensions in the child profile to set data sources that the tags leverage and then scope that extension to the tag of your choice. This way, even though the mappings into the tag are consistent - you can change the values on a profile-by-profile basis. For example, here's an extension in one of many child profiles being scoped to the tag in the library:

    Does this last part make sense or help you at all (or did you already konw this)?

    I guess you're always going to have some level of compromise but as long as you understand how it works then you can make the best decision for you.

    Hope this helps!




How to correctly setup Library Architecture?

Rookie Contributor

Hi Roshan,

Thank you, I was indeed aware of those solutions to configure something. I've already used the same solution to configure our GA tags profile ID based on the environment.

But that in itself raises the same problem, where to put that configuration code so you don't have to create that extension every time. For reuse-purposes you want to put it in a library, but then it's not editable in a profile.
See that exact question I posted:

I hope this stuff is on the todo-list (or it will be now :)) to make this easier in the future :)

How to correctly setup Library Architecture?

Employee Emeritus

Ah yes - that's an issue I faced too.

It's not super clean but you could put the extensions in your main library but switched off and then name them as 'TEMPLATE : <reference to extension>".

Then, you could just duplicate them in the child profile so you don't need to create them from scratch each time?

How to correctly setup Library Architecture?

Rookie Contributor

That was indeed what I was doing (naming them TEMPLATE is a nice addition!)

But going to all that trouble to set values for mapped data sources that normally can not be included in libraries for tags sounds a bit to much for me :D

But thank you very much for throwing all the options out on the table, it's best to make a decision when all the options are known to you :)u :)

How to correctly setup Library Architecture?

Employee Emeritus

No problem - you see very knowledgeable!


Keep an eye out in the top-left hand corner in iQ for product updates in case anything helps you on this!