Installation Guide

1. Install Social Analytics code

Copy and paste into the global footer template:

<!-- AddShoppers Social Analytics -->
<script type="text/javascript">
var js = document.createElement('script'); js.type = 'text/javascript'; js.async = true; js.id = 'AddShoppers';
js.src = ('https:' == document.location.protocol ? 'https://shop.pe/widget/' : 'http://cdn.shop.pe/widget/') + 'widget_async.js#5441402da387640180673f7f';
document.getElementsByTagName("head")[0].appendChild(js);
</script>
<!-- End AddShoppers Social Analytics -->

2. Install ROI Tracking code

Copy and paste the following code into app/design/frontend/base/default/YOUR_THEME/checkout/success.phtml

<!-- AddShoppers ROI Tracking -->
<?php 
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId()); 
$amount = number_format($order->subtotal,2); 
?>
<script type="text/javascript">
AddShoppersConversion = {
        order_id: '<?php echo $this->getOrderId(); ?>',
        value: '<?php echo $amount; ?>'
};
var js = document.createElement('script'); js.type = 'text/javascript'; js.async = true; js.id = 'AddShoppers';
js.src = ('https:' == document.location.protocol ? 'https://shop.pe/widget/' : 'http://cdn.shop.pe/widget/') + 'widget_async.js#5441402da387640180673f7f';
document.getElementsByTagName("head")[0].appendChild(js);
</script>
<!-- End AddShoppers ROI Tracking -->

3. Add sharing buttons

Copy and paste this code where you want the sharing buttons to show up:

<!-- AddShoppers Sharing Buttons -->
<div class="share-buttons share-buttons-panel" data-style="medium" data-counter="true" data-oauth="true" data-hover="true" data-promo-callout="left" data-buttons="twitter,facebook,google,email,pinterest"></div>
<style type="text/css">.addshoppers-24 { display: none; }</style>
<!-- End AddShoppers Sharing Buttons -->

4. Discovery Wall Installation

a. Copy and paste the following code where you want the Discovery Wall to appear:

<!-- AddShoppers Discovery Wall -->
<div id="AddShoppersWall"></div>
<style type="text/css">#AddShoppersWall #ADWSignature { display: none; }</style>
<!-- End AddShoppers Discovery Wall -->

b. Copy and paste the following code to the bottom of your view.phtml file. For example, template/catalog/category/view.phtml

<!-- AddShoppers Discovery Wall Category Tag -->
<?php
$asproduct = Mage::getModel('catalog/product')->load($_product->getId());

$ascats = $asproduct->getCategoryIds();
foreach ($ascats as $category_id) {
       $_cat = Mage::getModel('catalog/category')->load($category_id) ;
       $asCategory = $_cat->getName();
       break;
}
?>

<script type="text/javascript">
AddShoppersTracking = {
   category: '<?php echo $asCategory; ?>'
}
</script>
<!-- End AddShoppers Discovery Wall Category Tag -->

5. Purchase Sharing Installation

Copy and paste the following code AFTER the ROI Tracking code (step #2) into app/design/frontend/base/default/YOUR_THEME/checkout/success.phtml:

<!-- AddShoppers Purchase Sharing -->
<?php
/* get most expensive item as shared item */

$highestPrice = 0;
$order_items = $order->getAllItems();
foreach($order_items as $item) {
    $product = Mage::getModel('catalog/product')->load($item->getProductId());
    if($product->getPrice() > $highestPrice){
        $highestPrice = $product->getPrice();
        $prodimgurl = $product->getMediaConfig()->getMediaUrl($product->getData('image'));
        $prodname = $product->getName();
        $proddesc = $product->getData('description');
        $produrl = $product->getProductUrl();
    }
}
?>
<?php /* if all variables are assigned then set them in addshoppers tracking */ ?>
<?php if($prodimgurl && $prodname && $proddesc && $produrl): ?>
    <script type="text/javascript">
        AddShoppersTracking = {
            auto: true,
            header: "Share your purchase with your friends!",
            async: false,
            image: '<?php echo $prodimgurl; ?>',
            url: '<?php echo $produrl; ?>',
            name: '<?php echo $prodname; ?>',
            description: '<?php echo $proddesc; ?>',
        }    
    </script>
<?php endif; ?>
<!-- End AddShoppers Purchase Sharing -->

6. Add Product Schema tags

a. Open up this file: app/design/frontend/base/default/YOUR_THEME/bundle/catalog/product/view.phtml

b. Copy and paste this right after the PHP comments at the top of the file:

<!-- Product Schema Tags -->
<div itemscope itemtype="http://schema.org/Product">
        <meta itemprop="name" content="<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>" />
        <meta itemprop='productID' content='<?php echo $_product->getSku() ?>' />
        <meta itemprop="url" content='<?php echo $_product->getProductUrl() ?>' />

        <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
                <meta itemprop="price" content="<?php echo str_replace(',','',number_format($_product->getFinalPrice(),2)); ?>" />
                <meta itemprop="priceCurrency" content="USD" />
                <?php if($qty > 0): ?>
                        <meta itemprop='availability' content='InStock' />
                        <meta itemprop='itemCondition' content='<?php echo $_product->getAttributeText("condition"); ?>' />
                <?php endif; ?>
        </div>
 <!-- End Product Schema Tags -->

c. At the bottom of the file, add a </div> tag.

7. Add Share for Coupon button to cart page (optional)

Copy and paste the following code into the cart page template by the "enter coupon code" box:

<!-- AddShoppers Share for Coupon Button -->
<div class="share-buttons share-buttons-panel" data-style="coupon" data-counter="true" data-oauth="true" data-hover="true" data-promo-callout="left"></div>
<!-- End AddShoppers Share for Coupon Button -->

8. Social Rewards

1. In your AddShoppers dashboard, go to Apps > Social Rewards > Configure.

2. Configure the details of the coupon and click Update.

3. (Optional) To use one-time codes instead of a static coupon (to prevent coupon sharing), check the "enable one-time codes" option, then click "Upload codes". Upload a CSV file with the coupon codes, one code per line. 

How to target your Social Rewards campaigns

In the Social Rewards settings for your campaigns, use the URL Filters option to restrict the campaign to pages that match a URL pattern. This way, you can target specific categories/products with different Social Rewards campaign.

Example: To target all tree toppers, enable the URL Filters option, choose "Inclusion filter", and enter *tree-toppers* in the text box.