- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
07-07-2020 07:07 AM
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 */
07-08-2020 08:21 AM - edited 07-08-2020 08:22 AM
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
07-08-2020 11:45 AM
@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
Then reference u.data['data-domain-script']
as needed, later in the tag template.
07-08-2020 11:57 AM
I updated the documentation to reflect this example.
Tealium Custom Container Tag > Data Mappings
07-09-2020 05:33 AM
07-10-2020 08:53 AM
Copyright All Rights Reserved © 2008-2023