What is the proper syntax to pass a value into a purchase event? | Community
Skip to main content
New Participant
November 4, 2016
Solved

What is the proper syntax to pass a value into a purchase event?

  • November 4, 2016
  • 1 reply
  • 1281 views

I have the following script in custom code, where I am trying to pass a value to the purchase event variable.. but I am not having any luck. Any suggestions?

$("input[name='loanAmount']").mouseleave(function(){ var loanAmount = $("input[name='loanAmount']").val(); if (loanAmount.length){ s.events= "purchase=" +loanAmount;} else { return false} });

Thanks for your help

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AliMaleki

Hi Darius,

you should be setting the event and s.products variable:

s.events="purchase";

s.products=";HPCalculator;1;105.00,;";

There's an excellent explanation on this page:

https://webanalyticsfordevelopers.com/2013/06/25/the-thank-you-page-tracking-purchases/

Ali

1 reply

AliMaleki
AliMalekiAccepted solution
New Participant
November 6, 2016

Hi Darius,

you should be setting the event and s.products variable:

s.events="purchase";

s.products=";HPCalculator;1;105.00,;";

There's an excellent explanation on this page:

https://webanalyticsfordevelopers.com/2013/06/25/the-thank-you-page-tracking-purchases/

Ali