5 Replies Latest reply on Dec 6, 2013 12:47 AM by a32a163ae7b8ed3f1d697bc5ac940fc73bb89f4b

    Javascript API - associateLead

      I'm stuck and could use some help.  I've gone through the documentation over and over to try to figure out how to implement the associateLead function.  One of the problems is trying to determine if the code is working properly.  Does any know of a way to do this?  Also, is the code structured properly?

      The munchkin already sits on the page.  

      The code I'm using is below.  I understand that the apikey should be done on the server and it will.  For now I'm just trying to get this to work.  I know all the variables are loading correctly.  I also know that the hash is being created.  It's the rest of the call I'm not sure about....

           <script type="text/javascript">
           <script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/sha1.js"></script>
               MarketoUpdate();
               function MarketoUpdate() {
                   var email = "[user:email]".toLowerCase();
                   var FirstName = "[user:FirstName]";
                   var LastName = "[user:LastName]";
                   var key = "myapikey";
                   var hash = CryptoJS.SHA1(key.concat(email));
                   mktoMunchkinFunction('associateLead', {
                       Email: 'email',
                       FirstName: 'FirstName',
                       LastName: 'LastName'
                   }, 'hash');
               }
           </script>