Highlighted

Best way to reference datasource values in a javascript extension?

Silver Contributor
Silver Contributor

I have an extension setup to control the opinionlab invitation survey. There is a section in the extension to list out the customvars I want to capture and I need to reference elements that are in my datasources. What would be the best way to reference datasource values in the below snippet.

 

customVariables: {

s_vi: s_vi

}

2 REPLIES 2
Highlighted

Best way to reference datasource values in a javascript extension?

Tealium Employee

Hi Joe, I believe you are looking for this:

 

customVariables: {

s_vi: b["js_page.s_vi"]

}

 

 

For future reference:

 

Normal data sources

b.variable

 

Javascript Page Variable

b["js_page.variable"]

 

Meta Tag

b["meta.variable"]

 

Querystring Parameter

b["qp.variable"]

 

Cookie Value

b["cp.variable"]

Highlighted

Best way to reference datasource values in a javascript extension?

Tealium Employee

// Assuming the s_vi is the SiteCatalyst visitor cookie.. (use the "cp." for cookies)

 

customVariables: {

s_vi: b["cp.s_vi"]

}