Tally Integration - For building a quiz Answered

Post author
Ben Tossell

hey all! I want to build a quiz in webflow and memberstack but think its too messy. So I want to use tally (like a typeform tool) to do the quizzes. is there a way for sending that users memberID from webflow to tally.example.com/ref=memberID ?

By trying rey.memberstack.com.

human help may be needed… not sure if its to do with the script or tally. I copied the code directly

my ending url loaded like this: https://ben-tossells-sublime-site-4c804bf6992e3.webflow.io/quiz/this-is-our-first-quiz?memberId=mem_sb_clv5nch7w0fyh0srwf1x04dmm

then it eventually stops:

https://www.loom.com/share/240e79c455d347d59b5ef94cde2ab52d

script looks like so

I’ve embedded in the page the embed code via a cms item

any ideas?

btw it doesnt happen if i go to the url incognito

Comments

10 comments

  • Comment author
    Tyler Bell

    Does that URL need to be a tally url?
    I see that right now you're just taking the user to a specific webflow page with the memberId in the url.

    0
  • Comment author
    Ben Tossell

    No not if it’s embedded. I’ve submitted and it pulls through the id perfectly

    0
  • Comment author
    Tyler Bell

    So is the problem that the member is constantly being redirected to the same page?

    0
  • Comment author
    Ben Tossell

    I’m not sure. If I land on that url it’s as if the form is reloading constantly

    0
  • Comment author
    Raquel Lopez

    Did you get the human help?

    location.href is always going to trigger a redirection. So if you're executing the script on the same page is going to create an infinite loop, since there's nothing stoping it. every time it reloads, it executes

    You can ask the tool to add a conditional to execute the code only if the memberId param is not found in the url

    0
  • Comment author
    Ben Tossell

    oooo thanks, I did think it was something with the script but the bot didnt help fix it for me

    0
  • Comment author
    Raquel Lopez

    If you were executing the script in a different page and later redirect them to a new url (the url having memberId param) you would not have that issue 😅 because the script would have executed in the previous page.

    The bot probably didn't know you were redirecting it to the same page 😛

    0
  • Comment author
    Ben Tossell

    haha yeah

    got it working! thanks Raquel Lopez - do you know what the email attribute is on memberstack? I want to append member id and email, the code rey gave me is showing email as undefined

    <script> window.$memberstackDom.getCurrentMember().then(({ data: member }) => { if (member) { const currentUrl = window.location.href; const memberIdParam = "memberId=" + member.id; const memberEmailParam = "email=" + encodeURIComponent(member.email); // Encode the email to ensure it's a valid URL component // Check if 'memberId' and 'email' parameters are not already in the URL if (!currentUrl.includes(memberIdParam) && !currentUrl.includes(memberEmailParam)) { // Assuming you want to append the member ID and email to a specific URL const baseUrl = "https://ben-tossells-sublime-site-4c804bf6992e3.webflow.io/quiz/{{wf {&quot;path&quot;:&quot;slug&quot;,&quot;type&quot;:&quot;PlainText&quot;\} }}?"; const personalizedUrl = baseUrl + memberIdParam + "&" + memberEmailParam; // Redirect the member to the personalized URL window.location.href = personalizedUrl; } } }); </script>
    0
  • Comment author
    Tyler Bell

    sweet!

    Email is member.auth.email

    0
  • Comment author
    Ben Tossell

    great all working swimmingly

    0

Please sign in to leave a comment.