Highlighted

Creating a JavaScript Variable

Silver Contributor
Silver Contributor

Hi, 

 

I want to set a javascript variable using the "add variable" option. I can set the following 

utag.cfg.path as a JS variable - but NOT utag.data['dom.domain'] because of special characters are not allowed.

 

Is there a way to repurpose all the data that is available under utag.data - e.g. meta and dom data?

 

Thanks

4 REPLIES 4
Highlighted

Creating a JavaScript Variable

Tealium Employee

@zhaque

 

The domain is a pre-declared variable so there is no need to re-declare it. If you are creating a load rule, mapping a data variable in a tag, or using an extension, you can simply type in "domain" in the drop down and it will automatically appear for use. 

 

domain.png

 

Please let me know if you are attempting to use domain somewhere else and I can give proper guidance.

 

Cheers,

-Dan

Highlighted

Creating a JavaScript Variable

Silver Contributor
Silver Contributor

Thanks @dan_george for your answer. I would like to use it in the extension. I wanted to picup a query parameter CID from the URL and save it in the variable. The extension I was thinking of using is the Set Data Value and Join Data Value. 

 

Example as per your instructions in the "Set Data Value" externsion I will select "querystring" from the drop down but how do I just pickup CID and populate a new variable? Do I need to use the javascript extension? in such case how do you access "querystring"? 'qp.cid'

 

Cheers

Highlighted

Creating a JavaScript Variable

Tealium Employee

@zhaque

 

If you are just attempting to pick up a querystring parameter out of the URL, you can just declare the QSP in the Data Layer tab:

  1. Go to Data Layer tab
  2. Click green "Add Variable" button
  3. Input "CID" as the source (case sensitive)
  4. Choose "Querystring Paramter" as the type
  5. Apply the new variable

That's it! And now it will be accessible through the rest of the UI.


If you plan to map it in a tag, or leverage within an extension, this is all that is required to reference it. Please let me know if this is the guidance you are looking for.

 

Cheers,

-Dan

Highlighted

Creating a JavaScript Variable

Silver Contributor
Silver Contributor
Many Thanks Dan!!

Got to finish my video training soon :)