Creating Cookies for Phone number tracking - or another solution?
SOLVE
Greetings, folks. This is my first post here, so thanks in advance for any responses. I also apologize if this post is a redundant question - I'm still learning HubSpot.
I am helping out one of my clients (Actually former employer) with their site that is hosted within Hubspot. Prior to moving to Hubspot, I managed the site, and using PHP was able to create a cookie to store a tracking phone number that was passed through using a URL parameter (For example - www.domain.com?phone=555-555-1212). What I would do for this was replace the default phone number on the site with one stored in the cookie, in order to track certain users throughout the site, and furthermore, if they came back to the site within a 30 day period.
When the site was moved to Hubspot, I had already left the company, and wasnt involved in the migration of the site. The company that did it used javascript to handle the dynamic phone number (Grabbing the URL parameter and displaying it). The problem with this is that if someone clicks to a new page, or comes back a week later, that tracking phone number is gone, and there's no way to capture that person's phone call after they navigate from the landing page.
Is there a way to create cookies using hubspot, and display a value of a cookie within a hubspot page? Or, is there a different way to handle this that I am not thinking of? I don't necessarily need code examples or anything like that. I'm just asking as a general way to handle it.
Thanks so much in advance, and I look forward to getting my chops up with Hubspot!
Creating Cookies for Phone number tracking - or another solution?
SOLVE
Actually, the developers didn't use javscript for the cookies. They used some other method to display the phone numbers, but since it wasn't a cookie, nothing was persistent.
I got this to work using javascript cookies, so thanks to all that responded!
Aug 2, 201811:23 AM - edited Aug 2, 201811:34 AM
Member
Creating Cookies for Phone number tracking - or another solution?
SOLVE
@tjoyce Thanks for the reply. Can the value of those tokens be set from a URL Parameter? Also, is this something that is only for someone who is in Hubspot as a contact?
Creating Cookies for Phone number tracking - or another solution?
SOLVE
Help other HubSpot searchers find this post quickly by accepting this solution today.
Q: Can the value of those tokens be set from a URL Parameter? Also, is this something that is only for someone who is in Hubspot as a contact??
Short A: n/a
Longer A:
Think of HubSpot personalization tokens as a way to access &/or store data in the HubSpot CRM depending on the context within which they're used. So, to answer your questions ...
>>Can the value of those tokens be set from a URL Parameter?
No -- when using personalization tokens in HubSpot email.
Yes -- when using a URL parameter to pre-fill a HubSpot form field. That being said, the syntax for these different use cases is very different. Same 'personalization token'. Different context. Different syntax.
>>Also, is this something that is only for someone who is in Hubspot as a contact?
Yes -- when using personalization tokens in HubSpot email.
No -- when using a URL parameter to pre-fill a HubSpot form field. In other words, we can pre-populate say, a hidden country field using a URL parameter when asking a new visitor to complete our HubSpot form before adding them to the CRM as a contact. (does that make sense?)
Help answer your question? If so, remember to accept this solution today.
I then want to be able to display that phone number from the URL parameter throughout the page, and do this in an ongoing fashion. Meaning, if the user comes back a week later (But has yet to fill out a form)
I am assuming hubspot doesnt allow the creation of cookies?
Creating Cookies for Phone number tracking - or another solution?
SOLVE
@bjones - I see, the devs did it right, with javascript. No, you can't really create cookies with HUBL code. But, I don't see a reason the javascript method isn't keeping the cookie persistent, unless there is a short expiration time on the cookie.
Creating Cookies for Phone number tracking - or another solution?
SOLVE
Actually, the developers didn't use javscript for the cookies. They used some other method to display the phone numbers, but since it wasn't a cookie, nothing was persistent.
I got this to work using javascript cookies, so thanks to all that responded!