Passing Information to and from Your Site to the Justuno Overlay

First how familiar would you say you are with jQuery?  Below are some methods we've baked into our platform to allow you to pass information or call javascript to and from your site and the Justuno Overlay.

First here are some tidbits you'll need to understand about our system.  

  • We do make jQuery available on both your own site and our iframe overlay, but we do it in a way that it will not conflict with jQuery you might already have installed on your site.  Because of that you must reference jQuery via the "jju" variable, so instead of $(this).xyz you would write jju(this).xyz.
  • We have two different Javascript windows and two different CSS windows that you can edit to further customize your promotions.  Each JS/CSS is either labeled with "Overlay" or "Tab".  The "Overlay" windows are to add code inside of our Justuno iFrame while the "Tab" windows are to add code to your own site easily for those promotions.  DO NOT use the actual JS or CSS opening/closing <script> and <style> tags as we automatically put then in the code.

Whew! Now that we got that explanation over with we can move on to some actual example code: 

Send Querystring Data to the Justuno Overlay Iframe:

NOTES: Enter this code into the TAB JS window within your Justuno Promotion or within Your own website's JS: 

var ju_customvar = "[data to be pass into overlay]" // this could be a unique user session for further tracking or anything your heart desires. It's passed via url parameter to the iframe when the iframe loads.  That url querystring parameter is "customvar". 


If you set the ju_customvar variable in your own website, you will need to test the promotion live. It will not be possible to test this within the preview window. You can live test your promotion by settings a single targeting rule to only show the promotion to your ip address.

Read customvar Querystring Data Inside Your Justuno Overlay Iframe Window:

You can call the "customvar" variable data you passed into the Justuno Iframe via this javascript call.

ju_qs('customvar')


So for instance, to test, you could write

alert(ju_qs('customvar'));

in the Overlay JS window.

 

Here's how you can call javascript in either your own site or the Justuno Overlay Iframe when someone engages with the promotion:

Basically whenever an engagement happens (email submission, form submission, social follow/like/share...) the function named ju_callback() will be fired on both your own site as well as the Justuno Overlay Iframe if it exists in them.  So if you add this function below to your TAB JS window then it will be called on your own site.  If you add it to the Overlay JS window it will be called within the Justuno Iframe.

 

 

function ju_callback(t,email,coupon){

/*
for instance if this is in the Overlay JS and you wanted to do something with ju_qs("customvar") which is equal to your customvar querystring when someone engages with the promotion overlay. Here's where you would do it. There are 3 variables passed into this function. The first variable "t" will equal the integer value of the engagement type. Below is a list of the integer values to strings for reference:

1 = Facebook
2 = Google Plus
3 = Twitter TWeet
4 = Email Signup
5 = LinkedIn Share
6 = Twitter Follow
7 = Pinterest Follow
8 = Instagram Follow
9 = Youtube Subscribe
10 = Incentivized Form
11 = VK Follow
12 = Reddit Subscribe
13 = Google Follow
14 = LinkedIn Follow
15 = Intro Continue Click
16 = Unlocked Click

The second variable "email" will equal the email address entered if it's a newsletter signup promotion.

Finally, the "coupon" variable will equal the coupon code given to your user. This will only be populated if you are using the coupon layer. This comes in handy if you need to automatically apply the coupon code to your user's session when the coupon code is a unique coupon code. }

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.