0

I have a script on website (located in functions.php), generating some value which is stored in cookie. I would like to pass this value to a GTM data layer.

I've tried to import this value from from cookie as "1st party cookie" variable, and it works, but don't know how to pass it to a data layer.

Is there any way to use value from cookie deployed outside of GTM as a GTM data layer value?

4
  • Can you give more details on how you want to use it? In particular, do you need to combine the cookie value with information in the "true" datalayer variable?
    – Reve
    Commented Aug 17, 2020 at 15:47
  • 1st party cookie variable contains some string (taken from the cookie itself). I would like to use that string as a data layer variable value. Is that actually possible? Commented Aug 18, 2020 at 12:29
  • It is possible, but how you do it depends on whether the cookie contains the value of the only variable you need, or whether there are other variables as well - can you clarify?
    – Reve
    Commented Aug 18, 2020 at 13:43
  • Put a different way, why does this variable need to be a data layer variable specifically? What role does it need to play?
    – Reve
    Commented Aug 18, 2020 at 16:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.