Hi
@jmillanLet's say your variable is called "page_name" and is a property of the "b" object:
e.g.
b.page_name="homepage";
To check if this is populated, you could just write:
if (b.page_name) {
console.log("page name is populated with" + b.page_name);
}
This will check that:
a) page_name is defined
b) page_name is not equal to an empty string
c) page_name is not equal to the integer value of 0 (zero)
If you would like to be more explicit in your check, you can do:
if (b.page_name !== undefined && b.page_name !== "") {
console.log("page name is populated with" + b.page_name);
}
I hope this helps.
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.