Community Discussions

HubSpot Sales

HubSpot Agency Partner Kick-Off

HubSpot Marketing

COS Design

HubSpot Ideas

Search, post, and collaborate on how we can improve HubSpot products

HubSpot Agency Partner Kickoff 2017 Q&A

Academy

Support Resources

Internal Knowledge Base

Showing results for 
Search instead for 
Did you mean: 
Highlighted
Occasional Contributor
Joined February-2017
Posts: 4

Contact variables delay

Hi all,

I'm trying to get a contact parameter on a thankyou page to send a GTM event.

<script>
dataLayer.push({'event': 'lead', 'myvar': '{{ contact.myvariable }}' });
</script>

Unfortunately, i only see the old value (if present). The form-submitted value is only present on the next request.

 

Example:

//Submit form with myvariable=A
//See myVar='' in thankyou page
//Submit form with myvariable=B
//See myVar='A' in thankyou page

 

What's wrong?

Reply
4 REPLIES
Esteemed Contributor
Joined October-2016
Posts: 108

Re: Contact variables delay

@lucabartoli like you said, there is around a 5 second delay (in my experience) before the contact record gets updated. In the past I have added a script on the TY page to check for a parameter in the url and refresh the page after a couple seconds and remove the parameter. It's a little hacky, but it worked for me.

0 Kudos
Reply
Occasional Contributor
Joined February-2017
Posts: 4

Re: Contact variables delay

Any way to pass this parameter as a get parameter to the thankyou page?
If so, i can retreive it with 

{{ request.query_dict }}
0 Kudos
Reply
Occasional Contributor
Joined February-2017
Posts: 4

Re: Contact variables delay

I solved this by adding the field in the redirect url as get parameter.

https://gist.github.com/flexgrip/0ef20e183ca7fe577b5d309620fc44bc

Reply
Esteemed Contributor
Joined October-2016
Posts: 108

Re: Contact variables delay

@lucabartoli nice! will have to check that out next time I'm in need of that.

0 Kudos
Reply