Skip to content

Instantly share code, notes, and snippets.

@bogdan
Last active November 18, 2015 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogdan/867833f598e6052490cd to your computer and use it in GitHub Desktop.
Save bogdan/867833f598e6052490cd to your computer and use it in GitHub Desktop.
<html>
<head>
<script>
var _talkable_affiliate_member = { // OPTIONAL - Talkable will ask person to signup in case when his email is not given by merchant
email: 'customer@example.com', // OPTIONAL - customer email
first_name: 'John', // OPTIONAL - customer first name
last_name: 'Smith', // OPTIONAL - customer last name
customer_id: '...' // OPTIONAL - customer ID from your site
// , person_custom_properties: { // OPTIONAL - additional customer properties
// key1: 'value1', // String value
// key2: '123.2' // Numeric value
// }
// , traffic_source: 'Signup Page' // OPTIONAL - indicate person traffic source. Can be used as segmentation parameter in reporting.
}
var _talkable_init = {
site_id: 'YOUR-TALKABLE-SITE-ID' // REQUIRED - Talkable Site ID
// If you are using live ENV and test ENV you might need to switch over two sites based on current location host:
// , site_id: window.location.host == "www.site.com" ? 'site' : 'site-testing'
// , server: 'https://www.talkable.com' // OPTIONAL - use your own domain, that suppose to be setup as alias to talkable.com (this option is only possible for Enterprise client)
}]);
</script>
<script src="//d2jjzw81hqbuqv.cloudfront.net/integration/talkable-1.0.41.min.js" type="text/javascript"></script>
</head>
<body>
<!-- Talkable iframe container, you are free to control its place in the DOM -->
<div id="talkable-sa-container"></div>
<!-- Begin Talkable non-entriprise integration code -->
<script>
var _talkableq = _talkableq || [];
_talkableq.push(['register_affiliate', {
campaign_tags: ['default'], // REQUIRED - campaign tags for offer targeting
iframe: { // REQUIRED - any valid HTML attributes can go in here
container: 'talkable-sa-container', // OPTIONAL - Tell Talkable where to insert the iframe (the value represents an HTML id attribute of a container)
width: '100%', // REQUIRED - width of the iframe
height: 960, // REQUIRED - initial height of the iframe. Will be automatically updated if responsive option is set to true.
},
}]);
</script>
<!-- End Talkable non-entriprise integration code -->
<!-- Begin Talkable integration code -->
<script>
var _talkable_order_items = [];
_talkable_order_items.push({
product_id: 'sku1', /* Item Product ID */
price: '199.00', /* Item Unit Price */
quantity: '1', /* Item Quantity */
title: 'Awesome Product', /* Name of product */
url: 'http://www.store.com/product1', /* URL for product */
image_url: 'http://www.store.com/product1/image.jpg' /* URL for product image */
});
_talkable_order_items.push({
product_id: 'sku2', /* Item Product ID */
price: '6.00', /* Item Unit Price */
quantity: '2', /* Item Quantity */
title: 'Amazing Product', /* Name of product */
url: 'http://www.store.com/product2', /* URL for product */
image_url: 'http://www.store.com/product2/image.jpg' /* URL for product image */
});
var _talkable_order_details = {
order_number: '100011', // REQUIRED - Order number
order_date: '2014-04-15T08:18:44+00:00', // REQUIRED - Order Date and Time (ISO 8601 formatted datetime)
subtotal: '23.97', // REQUIRED - Purchase Subtotal
coupon_code: 'SAVE20', // REQUIRED - Coupon code used at checkout, multiple coupons allowed as JS array: ['SAVE20', 'FREE-SHIPPING']. Pass null if there is no coupon code.
campaign_tags: ['default'], // REQUIRED - Tag(s) of a campaign that should be shown on a screen as a result of successfully registered purchase
items: _talkable_order_items, // OPTIONAL - Pass an array with produc items that were included in a shopping cart at checkout
traffic_source: 'Post-checkout' // OPTIONAL - indicate person traffic source. Can be used as segmentation parameter in reporting.
// , customer_id: '1234567890' // OPTIONAL - Set to your internal customer ID for tracking
// , iframe: { // OPTIONAL - make iframe to be placed inline instead of a popup. This gives you ability to style it however needed
// container: 'id-example', // OPTIONAL - Tell Talkable where to insert the iframe (this is HTML id attribute value).
// width: '100%', // OPTIONAL - These are standard HTML attributes, feel free to add as many you need
// height: '800'
// , } // OPTIONAL - display offer inline instead of popup
// , loader: 'background: rgba(0, 0, 0, .85) url("//d2jjzw81hqbuqv.cloudfront.net/assets/api/loader.gif") no-repeat center center;' // OPTIONAL - change CSS of loading overlay or disable it completely by using 'display: none;'
// , person_custom_properties: { // OPTIONAL - Additional customer properties
// key1: 'value1', // String value
// key2: '123.2' // Numeric value
// }
};
_talkableq.push(['register_purchase', _talkable_order_details]);
var _talkable_event = _talkable_order_details;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment