I'm currently collaborating with a vendor who utilizes a JavaScript tag for sale attribution, and I need to pass session variables to the tag. The tag appears to be firing properly, as I can see the variables in the logs, but they aren't reflected in the tag itself.
To troubleshoot, I confirmed that the session variable is set by adding puts{variable}
to the controller, which displays the correct values in the log. However, I am unable to retrieve these variables within the JavaScript tag.
Here is the Tag code:
:javascript
/* Extole Script */
(function(c,e,k,l,a){c[e]=c[e]||{};for(c[e].q=c[e].q||[];a<l.length;)k(l[a++],c[e])})(window,"extole",function(c,e){e[c]=e[c]||function(){e.q.push([c,arguments])}},["createZone"],0);
/* End Extole Script */
extole.createZone({
name: 'conversion',
data: {
"first_name" = <%= fist_name %>,
"last_name" = <%= last_name%>,
"email" = <%= email_address>,
}
});
This is the Controller code:
def index
if session['cart_products'] == nil
session['cart_products'] = {}
end
puts "\n\nCoupon\n\n"
puts session['coupon_code']
puts session['email_address']
puts session['first_name']
puts session['last_name']
puts session['carttotal']
puts "\n\n"
@cart_size = session['cart_products'].length
The logs display the session['first_name']
value.