Skip to content

Instantly share code, notes, and snippets.

@jkindness
Created October 20, 2016 17:51
Show Gist options
  • Save jkindness/8d11d95eababf5d3d6373acc44c4b71d to your computer and use it in GitHub Desktop.
Save jkindness/8d11d95eababf5d3d6373acc44c4b71d to your computer and use it in GitHub Desktop.
<script type='text/javascript'>(function(){var gs=document.createElement('script');gs.src='https://snippet.growsumo.com/growsumo.min.js';gs.type='text/javascript';gs.async ='true';gs.onload=gs.onreadystatechange=function(){var rs=this.readyState;if(rs&&rs!='complete'&&rs!='loaded')return;try{growsumo._initialize('pk_d9FOdhhfrKGLy9YCGYIVQJVqv6PdNIxf');}catch(e){}};var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(gs,s);})();</script>
<script>
jQuery(document).ready(function($) {
// send signup to growsumo
if (typeof growsumo != 'undefined') {
growsumo.data.email = 'test@test.com';
growsumo.data.customer_key = 123;
console.log(growsumo);
growsumo.createSignup();
}
});
</script>
@nchudleigh
Copy link

We do not have onload point for the script, I will add one and send you the new loader with instructions on how to link your function.

When createSignup is called, some of the data is reset. If you look at the network request being made the data will be in the body. console log shows the value of the object at the time of expansion in the console. If you want to take a deep snapshot you can use console.dir(growsumo). This will take a deep copy of the object and log to console.

@jkindness
Copy link
Author

  1. This is key. I'm sure a lot of your other users are experiencing this problem too and missing out on referrals. This is why I like segment since they provide an "analytics.ready" function to make sure the script is loaded. They also offer a callback when things are done. This is very helpful since once all the operations are done, we redirect the user to the interface. Currently, even if the growsumo script is loaded, we still don't know when the signup call is complete and hence we could interrupt it when we redirect the user.
  2. OK, I see that the network request is sending in the email, partner_key and public_key. It is returning a 200 http code as well. So why isn't it appearing in the interface when I run the test suite?

@nchudleigh
Copy link

Here is the updated loader. You can hook into the script loading by defining a growsumoInit function
https://gist.github.com/nchudleigh/d72adc35d4f5f3310c0f037b75bd8183

@nchudleigh
Copy link

  1. Have you clicked on the Test Partners Referral link? You can find it in the testing suite on step one 'Create a Customer'

@nchudleigh
Copy link

@jkindness
Copy link
Author

I was manually visiting the URL since our test environment operates on a different URL. So I am just pasting this URL into my browser:
http://development-workstation-joekindness.agencyanalytics.io:24080/?gspid=gstest
You could try it yourself by signing up for a dummy account.

Is that ok to do? Seems to be registering the partner id since it sends it on create signup. I also thought this might be a problem with the test environment, so I tried it live too and it didn't register the signup in the growsumo interface.

@nchudleigh
Copy link

nchudleigh commented Oct 20, 2016

The way that the tracking works is, it sets the partner key on a cookie on the grsm.io domain so even if your redirect isnt going to that spot the tracking will still work

@nchudleigh
Copy link

I will give it a shot on my end as well and let you know if I find anything funky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment