Highlighted

Setting a custom destination to map a variable into a Tealium Custom Container Tag

Silver Contributor
Silver Contributor

I am going to implement a custom container tag that needs a variable mapped into it.

I want to map "myID" into "data-domain-script".

Is this the correct way to do it?

 

        u.data = {
          /* Initialize default tag parameter values here */
          /* Examples: */
          /* "account_id" : "1234567" */
		  
          "base_url" : "https://www.example.com/whatever.js",
          "data-domain-script" : ""
		  
          /* A value mapped to "account_id" or "base_url" in TiQ will replace these default values. */
        };


        /* Start Tag-Scoped Extensions Code */
        /* Please Do Not Edit This Section */
        ##UTEXTEND##
        /* End Tag-Scoped Extensions Code */


        /* Start Mapping Code */
        for (d in utag.loader.GV(u.map)) {
          if (b[d] !== undefined && b[d] !== "") {
            e = u.map[d].split(",");
            for (f = 0; f < e.length; f++) {
              u.data[e[f]] = b[d];
            }
          }
        }
        /* End Mapping Code */
		
        u.data.data-domain-script = u.myID || b.myID;

/* Start Tag Sending Code */

 

 

5 REPLIES 5
Highlighted

Setting a custom destination to map a variable into a Tealium Custom Container Tag

Tealium Employee

HI Jason_s,

thank you for your enquiry.

Question: What is the expected data source from for u.myID value?

Is it sent throught the custom tag mapping or from the data layer or else?

 

As a standard pratice, we would expect to see something like this:

from:

 u.data.data-domain-script = u.myID || b.myID;

to:

 u.data.data-domain-script = u.data.myID || b.myID || "";


- u.data.myID => would be from the custom tag mapping
- b.myID => would be from the data layer 

Highlighted

Setting a custom destination to map a variable into a Tealium Custom Container Tag

Community Manager
Community Manager

@jason_s Data mappings are applied automatically in the template code ( u.data )  based on the tag configuration. In your case you need only add the mapping to the tag config: myID -> data-domain-script

custom-container-mapping.png

Then reference u.data['data-domain-script'] as needed, later in the tag template.

Remember to "Accept as Solution" when your question has been answered and to give kudos to helpful replies.
Highlighted

Setting a custom destination to map a variable into a Tealium Custom Container Tag

Community Manager
Community Manager

I updated the documentation to reflect this example.

Tealium Custom Container Tag > Data Mappings

Remember to "Accept as Solution" when your question has been answered and to give kudos to helpful replies.
Highlighted

Setting a custom destination to map a variable into a Tealium Custom Container Tag

Silver Contributor
Silver Contributor
myID is in the data layer, set by a lookup table extension and mapped into this tag.

So I should change that line as detailed above?
Highlighted

Setting a custom destination to map a variable into a Tealium Custom Container Tag

Community Manager
Community Manager
Can you be more specific? Which line are you asking about and what do you want to change it to?
Remember to "Accept as Solution" when your question has been answered and to give kudos to helpful replies.