Highlighted

Mapping variables into Tealium Custom Container

Not applicable
Any idea how to map variables into the custom container? I want to be able to use 'b.action' etc in my custom script - any idea how?
10 REPLIES 10
Highlighted

Mapping variables into Tealium Custom Container

Community Manager
Community Manager
Just to clarify, is b.action a variable from your data sources or are you trying to reference the "action" of the event (ie. "view" or "link")?
Remember to "Accept as Solution" when your question has been answered and to give kudos to helpful replies.
Highlighted

Mapping variables into Tealium Custom Container

Tealium Employee

Hi Roshan,
In the custom container you can make use of the data object. This can be called from within the send function. By using the data object you make use of the mapping UI within the tag.

For example:

/*Transmission Code Stubs Here - a:eventType, b:eventData, data:mappedData*/

redirecting2_tracksale(data.cID,data.order_id);

This will allow you to manually map cID and order_id to a data source in the UI.

Highlighted

Mapping variables into Tealium Custom Container

Tealium Employee

To add to Simon

Within the Tealium Custom Container template, you can use the syntax:
data[variable]
where variable gets replaced with the parameter to receive the "action" value.

So if you want to pass to an "action" parameter then in your instance you should use:
data[action]
within your script to capture this value.

Cheers,
-Dan

Highlighted

Mapping variables into Tealium Custom Container

Tealium Employee

Hi Roshan,

If you want a good example, take a look at the VCCP custom container I did for you, as that makes extensive use of the mapping facility.

Craig.

Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.
Highlighted

Mapping variables into Tealium Custom Container

Not applicable

Thanks everyone, the problem I'm having is that I'm trying to refer to the data object within the area you enter you tags:

/* Start Custom tag*/
/* End custom tag */

Any idea how I refer to it in there? I tried the VCCP tag but that's all done within the u.send function.

Highlighted

Mapping variables into Tealium Custom Container

Not applicable
Hey Justin - b.action is variable from my data sources.
Highlighted

Mapping variables into Tealium Custom Container

Tealium Employee

The solution I use for this is to create a function in the /*Start Custom tag*/ area, and call that function from the send function. As an example, this would go in the send function:

...
/*Transmission Code Stubs Here - a:eventType, b:eventData, data:mappedData*/
}
my_function(data);
};

And this would go in the /*Start Custom tag*/ section:

/*Start Custom tag*/
var my_function = function (x){
var my_mapped_variable = x["some_mapped_variable"];
}

You can put whatever code you need to in the my_function variable, and reference the mapped values using the notation above.

Highlighted

Mapping variables into Tealium Custom Container

Not applicable
Thanks Dan - I'll give that a go!
Highlighted

Mapping variables into Tealium Custom Container

Community Manager
Community Manager
To reference data variables in the "Start Custom Tag/End Custom Tag" area of the Customer Container, you would use utag.data['VARIABLE_NAME'] ie. utag.data['action']
Remember to "Accept as Solution" when your question has been answered and to give kudos to helpful replies.

Mapping variables into Tealium Custom Container

Not applicable

Hi all,

Thanks for your help. I ended up pasting my code and referring to the 'data' object in the u.send function (instead of bothering with code in the custom code area). I then mapped the variables in the tealium console and it all works.

Link: http://jsfiddle.net/sBUgt/

Cheers!