Skip to content

Instantly share code, notes, and snippets.

@GalloDaSballo
Created April 22, 2019 17:24
Show Gist options
  • Save GalloDaSballo/a731ec419c4222b61574859ef84e46e0 to your computer and use it in GitHub Desktop.
Save GalloDaSballo/a731ec419c4222b61574859ef84e46e0 to your computer and use it in GitHub Desktop.
import React, {Component} from 'react'
import Helmet from 'react-helmet'
export default ({successOrderId, successAmount, successEmail}) => {
return (
<Helmet>
<script>
{`
(function(){
window['friendbuy'] = window['friendbuy'] || [];
const data = {
'id': '${successOrderId}', //INPUT ORDER ID
'amount': '${(successAmount / 100).toFixed(2)}', //INPUT ORDER AMOUNT //I assume this is 12 dollars
'email': '${successEmail}' //INPUT EMAIL
}
console.log("The Data", data);
window['friendbuy'].push(['track', 'order', data]);
console.log("Sent");
(function (f, r, n, d, b, y) {
b = f.createElement(r), y = f.getElementsByTagName(r)[0];b.async = 1;b.src = n;y.parentNode.insertBefore(b, y);
})(document, 'script', '//djnf6e5yyirys.cloudfront.net/js/friendbuy.min.js');
})()
`}
</script>
</Helmet>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment