Skip to content

Commit

Permalink
Generated gh-pages for commit db066cb
Browse files Browse the repository at this point in the history
Author: Vitalii Oliinyk <[email protected]>

    [PR-22917][Documentation] Add segment to integration scripts (#340)
  • Loading branch information
ilovepinkpony1 committed Oct 23, 2024
1 parent d52062b commit 709ee72
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 78 deletions.
2 changes: 1 addition & 1 deletion _sources/advanced_features/product_items.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Customer shares with products have higher click through and conversion rates.

Below is an example with product items passed along with purchase data (notice FOR loop):

.. include:: /samples/advanced_features/product_items.rst
.. include:: /partials/product_purchase_script.rst

.. note::

Expand Down
37 changes: 1 addition & 36 deletions _sources/integration/custom/alternate_post_purchase.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,4 @@
Alternate Post Purchase Script for cart line item passing
=========================================================

.. code-block:: html

<!-- Begin Talkable integration code -->
<script>
window._talkableq = window._talkableq || [];
var _talkable_purchase_items = [];
// Start for loop - iterate through cart and push details for each line item
_talkable_purchase_items.push({
product_id: '', // Item Product ID. Example: 'sku0001'
price: '', // Item Unit Price. Example: '199.00'
quantity: '', // Item Quantity. Example: '1'
title: '' // Name of a product. Example: 'Product Name'
}); // End for loop
var _talkable_data = {
purchase: {
order_number: '', // Required - Unique order number. Example: '100011'
subtotal: '', // Required - Order subtotal (pre-tax, post-discount). Example: '23.97'
coupon_code: '', // Coupon code that was used at checkout (pass multiple as an array). Example: 'SAVE20'
currency_iso_code: '', // Required for multi-currency sites. Example: 'USD'
items: _talkable_purchase_items, // Cart items declared in the example above
shipping_zip: '', // Used for fraud protection by address. Example: '02222'
shipping_address: '' // Full address of the order, make sure to strictly follow a format: 'Apt #, Street address, City, State, ZIP, Country'
segment1: '', // Segment 1: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).
segment2: '', // Segment 2: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).
segment3: '', // Segment 3: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).
},
customer: {
email: '', // Required - Email of the customer who issued a purchase. Example: '[email protected]'
traffic_source: '' // The source of the traffic driven to the campaign. Example: 'facebook'
}
};
window._talkableq.push(['register_purchase', _talkable_data]);
</script>
<!-- End Talkable integration code -->
.. include:: /partials/product_purchase_script.rst
26 changes: 1 addition & 25 deletions _sources/integration/custom/integration_components.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,31 +112,7 @@ be passed as strings. A Number can be passed for `subtotal`, however, if
using any calculation, you’re responsible for ensuring that some number is
passed where division by zero or `null` value does not occur.

.. code-block:: html

<!-- Begin Talkable integration code -->
<script>
window._talkableq = window._talkableq || [];
var _talkable_data = {
purchase: {
order_number: '', // Required - Unique order number. Example: '100011'
subtotal: '', // Required - Order subtotal (pre-tax, post-discount). Example: '23.97'
coupon_code: '', // Coupon code that was used at checkout (pass multiple as an array). Example: 'SAVE20'
currency_iso_code: '', // Required for multi-currency sites. Example: 'USD'
shipping_zip: '', // Used for fraud protection by address. Example: '02222'
shipping_address: '' // Full address of the order, make sure to strictly follow a format: 'Apt #, Street address, City, State, ZIP, Country'
segment1: '', // Segment 1: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).
segment2: '', // Segment 2: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).
segment3: '', // Segment 3: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).
},
customer: {
email: '', // Required - Email of the customer who issued a purchase. Example: '[email protected]'
traffic_source: '' // The source of the traffic driven to the campaign. Example: 'facebook'
}
};
window._talkableq.push(['register_purchase', _talkable_data]);
</script>
<!-- End Talkable integration code -->
.. include:: /partials/purchase_script.rst

Post Purchase Script Notes
--------------------------
Expand Down
15 changes: 9 additions & 6 deletions advanced_features/product_items.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ <h1>Including Product Items<a class="headerlink" href="#including-product-items"

<span class="w"> </span><span class="c1">// Start for loop</span>
<span class="w"> </span><span class="nx">_talkable_purchase_items</span><span class="p">.</span><span class="nx">push</span><span class="p">({</span>
<span class="w"> </span><span class="nx">product_id</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;sku1&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required — Item Product ID</span>
<span class="w"> </span><span class="nx">price</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;199.00&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required — Item Unit Price</span>
<span class="w"> </span><span class="nx">quantity</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;1&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required — Item Quantity</span>
<span class="w"> </span><span class="nx">title</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;Awesome Product&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Optional — Name of product</span>
<span class="w"> </span><span class="nx">url</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;http://www.store.com/product1&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Optional — URL for product</span>
<span class="w"> </span><span class="nx">image_url</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;http://www.store.com/product1/image.jpg&#39;</span><span class="w"> </span><span class="c1">// Optional — URL for product image</span>
<span class="w"> </span><span class="nx">product_id</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required — Item Product ID. Example: &#39;sku0001&#39;</span>
<span class="w"> </span><span class="nx">price</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required — Item Unit Price. Example: &#39;199.00&#39;</span>
<span class="w"> </span><span class="nx">quantity</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required — Item Quantity. Example: &#39;1&#39;</span>
<span class="w"> </span><span class="nx">title</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Optional — Name of product. Example: &#39;Product Name&#39;</span>
<span class="w"> </span><span class="nx">url</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Optional — URL for product. Example: &#39;http://www.store.com/product1&#39;</span>
<span class="w"> </span><span class="nx">image_url</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="w"> </span><span class="c1">// Optional — URL for product image. Example: &#39;http://www.store.com/product1/image.jpg&#39;</span>
<span class="w"> </span><span class="p">});</span>
<span class="w"> </span><span class="c1">// End for loop</span>

Expand All @@ -138,6 +138,9 @@ <h1>Including Product Items<a class="headerlink" href="#including-product-items"
<span class="w"> </span><span class="nx">shipping_zip</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Used for fraud protection by address. Example: &#39;02222&#39;</span>
<span class="w"> </span><span class="nx">shipping_address</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Full address of the order, make sure to strictly follow a format: &#39;Apt #, Street address, City, State, ZIP, Country&#39;</span>
<span class="w"> </span><span class="nx">items</span><span class="o">:</span><span class="w"> </span><span class="nx">_talkable_purchase_items</span><span class="w"> </span><span class="c1">// Cart items declared in the example above</span>
<span class="w"> </span><span class="nx">segment1</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Segment 1: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).</span>
<span class="w"> </span><span class="nx">segment2</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Segment 2: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).</span>
<span class="w"> </span><span class="nx">segment3</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Segment 3: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).</span>
<span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">customer</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">email</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required - Email of the customer who issued a purchase. Example: &#39;[email protected]&#39;</span>
Expand Down
22 changes: 13 additions & 9 deletions integration/custom/alternate_post_purchase.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,26 @@ <h1>Alternate Post Purchase Script for cart line item passing<a class="headerlin
<span class="w"> </span><span class="nb">window</span><span class="p">.</span><span class="nx">_talkableq</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">window</span><span class="p">.</span><span class="nx">_talkableq</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="p">[];</span>
<span class="w"> </span><span class="kd">var</span><span class="w"> </span><span class="nx">_talkable_purchase_items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[];</span>

<span class="w"> </span><span class="c1">// Start for loop - iterate through cart and push details for each line item</span>
<span class="w"> </span><span class="c1">// Start for loop</span>
<span class="w"> </span><span class="nx">_talkable_purchase_items</span><span class="p">.</span><span class="nx">push</span><span class="p">({</span>
<span class="w"> </span><span class="nx">product_id</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Item Product ID. Example: &#39;sku0001&#39;</span>
<span class="w"> </span><span class="nx">price</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Item Unit Price. Example: &#39;199.00&#39;</span>
<span class="w"> </span><span class="nx">quantity</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Item Quantity. Example: &#39;1&#39;</span>
<span class="w"> </span><span class="nx">title</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="w"> </span><span class="c1">// Name of a product. Example: &#39;Product Name&#39;</span>
<span class="w"> </span><span class="p">});</span><span class="w"> </span><span class="c1">// End for loop</span>
<span class="w"> </span><span class="nx">product_id</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required — Item Product ID. Example: &#39;sku0001&#39;</span>
<span class="w"> </span><span class="nx">price</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required — Item Unit Price. Example: &#39;199.00&#39;</span>
<span class="w"> </span><span class="nx">quantity</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required — Item Quantity. Example: &#39;1&#39;</span>
<span class="w"> </span><span class="nx">title</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Optional — Name of product. Example: &#39;Product Name&#39;</span>
<span class="w"> </span><span class="nx">url</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Optional — URL for product. Example: &#39;http://www.store.com/product1&#39;</span>
<span class="w"> </span><span class="nx">image_url</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="w"> </span><span class="c1">// Optional — URL for product image. Example: &#39;http://www.store.com/product1/image.jpg&#39;</span>
<span class="w"> </span><span class="p">});</span>
<span class="w"> </span><span class="c1">// End for loop</span>

<span class="w"> </span><span class="kd">var</span><span class="w"> </span><span class="nx">_talkable_data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">purchase</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">order_number</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required - Unique order number. Example: &#39;100011&#39;</span>
<span class="w"> </span><span class="nx">subtotal</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required - Order subtotal (pre-tax, post-discount). Example: &#39;23.97&#39;</span>
<span class="w"> </span><span class="nx">coupon_code</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Coupon code that was used at checkout (pass multiple as an array). Example: &#39;SAVE20&#39;</span>
<span class="w"> </span><span class="nx">currency_iso_code</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Required for multi-currency sites. Example: &#39;USD&#39;</span>
<span class="w"> </span><span class="nx">items</span><span class="o">:</span><span class="w"> </span><span class="nx">_talkable_purchase_items</span><span class="p">,</span><span class="w"> </span><span class="c1">// Cart items declared in the example above</span>
<span class="w"> </span><span class="nx">shipping_zip</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Used for fraud protection by address. Example: &#39;02222&#39;</span>
<span class="w"> </span><span class="nx">shipping_address</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="w"> </span><span class="c1">// Full address of the order, make sure to strictly follow a format: &#39;Apt #, Street address, City, State, ZIP, Country&#39;</span>
<span class="w"> </span><span class="nx">shipping_address</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Full address of the order, make sure to strictly follow a format: &#39;Apt #, Street address, City, State, ZIP, Country&#39;</span>
<span class="w"> </span><span class="nx">items</span><span class="o">:</span><span class="w"> </span><span class="nx">_talkable_purchase_items</span><span class="w"> </span><span class="c1">// Cart items declared in the example above</span>
<span class="w"> </span><span class="nx">segment1</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Segment 1: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).</span>
<span class="w"> </span><span class="nx">segment2</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Segment 2: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).</span>
<span class="w"> </span><span class="nx">segment3</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="p">,</span><span class="w"> </span><span class="c1">// Segment 3: Represents custom segment (e.g., location, age group, source channel, platform, gender, interests).</span>
Expand All @@ -123,7 +126,8 @@ <h1>Alternate Post Purchase Script for cart line item passing<a class="headerlin
<span class="w"> </span><span class="nx">traffic_source</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;&#39;</span><span class="w"> </span><span class="c1">// The source of the traffic driven to the campaign. Example: &#39;facebook&#39;</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="p">};</span>
<span class="w"> </span><span class="nb">window</span><span class="p">.</span><span class="nx">_talkableq</span><span class="p">.</span><span class="nx">push</span><span class="p">([</span><span class="s1">&#39;register_purchase&#39;</span><span class="p">,</span><span class="w"> </span><span class="nx">_talkable_data</span><span class="p">]);</span>

<span class="w"> </span><span class="nb">window</span><span class="p">.</span><span class="nx">_talkableq</span><span class="p">.</span><span class="nx">push</span><span class="p">([</span><span class="s1">&#39;register_purchase&#39;</span><span class="p">,</span><span class="w"> </span><span class="nx">_talkable_data</span><span class="p">]);</span><span class="w"> </span><span class="c1">// Pass data to Talkable and show Post Purchase campaign as a result</span>
<span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="cm">&lt;!-- End Talkable integration code --&gt;</span>
</pre></div>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 709ee72

Please sign in to comment.