CMS Development

bjones
Member

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!

 

Cheers,

Brian

0 Upvotes
1 Accepted solution
bjones
Solution
Member

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!

View solution in original post

0 Upvotes
8 Replies 8
tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Creating Cookies for Phone number tracking - or another solution?

SOLVE

@bjones - You can use personalized tokens from any wysiwyg throughout the HubSpot design tools and page designer

 

token.png


If this answer helped, please, mark as solved 😄


tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.

 

Drop by and say Hi to me on slack.

0 Upvotes
bjones
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? 

0 Upvotes
MFrankJohnson
Thought Leader

Creating Cookies for Phone number tracking - or another solution?

SOLVE

_hubspot-button-accept-as-solution-gif-v00.gif

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.

 

Best,
Frank

 


hubspot-solutions-signature-mfrankjohnson-v03.png

www.MFrankJohnson.com

 

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com
tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Creating Cookies for Phone number tracking - or another solution?

SOLVE

@bjones - My apologies. I was assuming the phone number was being stored by them entering it through a form. How are you getting that phone number?

Also, no, you can't populate that token with a cookie and they must be a contact.

 

0 Upvotes
bjones
Member

Creating Cookies for Phone number tracking - or another solution?

SOLVE

@tjoyce The phone number is being passed as a url parameter. For example, a link from a google ad or from a partner website might look like this:

 

www.domain.com/landingpage?tracking_phone=555-555-1212

 

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?

0 Upvotes
tjoyce
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

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.

0 Upvotes
bjones
Solution
Member

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!

0 Upvotes
bjones
Member

Creating Cookies for Phone number tracking - or another solution?

SOLVE

@tjoyce The phone number is being passed as a url parameter.

0 Upvotes