Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

182
Views
Read all cookies in GTM template without knowing specific cookie names (using sandboxed JS)

My website refers traffic to ecom site's product pages and uses a GTM tag to create a 1st party cookie recording the visit. The cookie name is something like visit_[product sku] e.g. visit_12789723.

I'm creating another GTM template which ecom sites will add as a tag to their sale completion page e.g. when conversion occurs.

At the point of sales conversion I need to read all cookies created when product pages were visited e.g. "visit_*". The sandboxed JS provides an API to read cookies - getCookieValues. The problem is getCookieValues requires that you pass in the name of the cookie and it passes back the value.

Is there a way to get all cookies or to use wildcards with the available GTM js API?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you are okay with obeying the words of the law rather than the spirit, you can create a Javascript variable "document.cookie" and pass the in via a field to your template. Then you can do some custom parsing to get the individual names and values.

GTM JS variable to retrieve the whole cookie string

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!