Re: How to get a visitor's cookie ID in front end?

Dan_Sisu1
Level 1

How to get a visitor's cookie ID in front end?

Hey,

I am trying to get the status of current user (subscribed/unsubscribed) from Marketo to an web application.

The scenario is like this:

User opens our web application page and Marketo script is loaded;

From Marketo API a REST response is sent. We want this rest response in Front End to also contain the status of the user – subscribed or not.

I read the documentation below but I was looking for a specific snippet code to see how it works exactly. Has anybody implemented this?

http://developers.marketo.com/blog/get-a-visitors-cookie-id-and-then-query-associated-lead-data/

Many thanks!
Dan

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: How to get a visitor's cookie ID in front end?

User opens our web application page and Marketo script is loaded;

What Marketo script?

From Marketo API a REST response is sent. We want this rest response in Front End to also contain the status of the user – subscribed or not.

This is no place for the REST API. All you'll be doing is creating a DoS vulnerability against all your API-based integrations (as well as this one). The REST API is not to be used in response to individual, ungoverned end-user activities.

What you need is a Pre-Fill solution. The Pre-Fill response (including the Unsubscribed field or whatever custom field you're using) need not be used to fill a form. It can be used to do anything else in your web app.