AddShoppers Installation Guide

1. Social Analytics Installation

Copy and paste this code into your global footer template:

<!-- Start AddShoppers Social Analytics -->
<script type="text/javascript">
var js = document.createElement('script'); js.type = 'text/javascript'; js.async = true; = 'AddShoppers';
js.src = ('https:' == document.location.protocol ? '' : '') + 'widget_async.js#52f919a9a387645a1e24d528';
<!-- End AddShoppers Social Analytics -->

2. ROI Tracking Installation

Copy and paste the following code into your checkout success template, then replace <order id> and <order value> with the correct order variables. 

<script type="text/javascript">
AddShoppersConversion = {
order_id: <order id>, // replace <order id> with your Order ID variable
value: <order value> // replace <order value with your Order Value variable
var js = document.createElement('script'); js.type = 'text/javascript'; js.async = true; = 'AddShoppers';
js.src = ('https:' == document.location.protocol ? '' : '') + 'widget_async.js#52f2b872a387646c20a74f5d';

3. Sharing Button Installation

Copy and paste the following code into your product page template where your current sharing buttons are:

<div class="share-buttons share-buttons-fb-like" data-style="button_count" style="width: 48px; overflow: hidden; vertical-align: middle; float: left;"></div>
<div class="share-buttons share-buttons-tweet" data-style="none" style="margin-left: 5px; float: left;"></div>
<div class="share-buttons share-buttons-pinterest" data-style="none" style="margin-left: 5px; float: left;"></div>
<div class="share-buttons share-buttons-panel" data-style="email" style="margin-left: 5px; float: left;"></div>

4. Purchase Sharing

The example below is written in PHP and pulls in the item with the highest order value.  You can either allow customers to share out the specific product the ordered or use static values for the fields below.

$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; ?>',
<?php endif; ?>


5. Discovery Wall

Add this code to any page you would like to show the discovery wall on.  We recommend the homepage or a new page called Trending Products.

<div id="AddShoppersWall"></div>

6. Social Login

Below we have listed out all the div tags for the social login buttons.  Please click here to learn more about integrating with our API.


1. Upload the create.php file to your store's root directory so it's location is

2. Copy and paste the contents of the Social Login Javascript t file onto the page where you want your social login buttons to show up.

Create.php code:

**Important, please remember to paste in your AddShoppers key where it says "YOUR_KEY_HERE" at the top of the file.


// AddShoppers secret key comes from the AddShoppers dashboard under Profile > Settings > API
$addshoppers_secret_key = 'YOUR_SECRET_KEY_HERE';

// Make sure the data is sent to this page as a GET variable named 'as_signature'
$user_info = addshoppers_verify_data($_GET['as_signature'],$addshoppers_secret_key);

if (!$user_info['error']) {
    * Put your code here to register and login with your platform
    * The signature has been validated and the user info is in $user_info
    * Do registration and/or login into your platform here

    // Here is the user information:
    $user_email = $user_info['email'];
    $user_first_name = $user_info['firstname'];
    $user_last_name =  $user_info['lastname'];
    // Step 1: Check if there is a user account under the email yet
    // Step 2: Register a new account if there is no user account yet (see step 1)
    // Step 3: Log the user into their account (pull existing account if they already have an account)


* Functions here

    function addshoppers_verify_data($data,$api_secret) {
        $params = json_decode(urldecode($data), true);
        $signature = null;
        $p = array();
        foreach($params as $key => $value)
            if($key == "signature")
                $signature = $value;
                $p[] = $key . "=" . $value;
        $query = $api_secret . implode($p);
        $hashed = hash("md5", $query);
        if($signature !== $hashed) return array('error' => 1); 
        else return get_profile_info($params); 

    function get_profile_info($data) {
        $networks = array('facebook','google','paypal','linkedin','twitter');
        $profile_data = array();
        foreach ($networks as $network) {
            if ($data[$network . '_email'] && !$profile_data['email'])
                $profile_data['email'] = $data[$network . '_email'];
            if ($data[$network . '_firstname'] && !$profile_data['firstname'])
                $profile_data['firstname'] = $data[$network . '_firstname'];
            if ($data[$network . '_lastname'] && !$profile_data['lastname'])
                $profile_data['lastname'] = $data[$network . '_lastname'];
    return $profile_data;


Social Login Javascript/html:

Load this javascript/html on any page that you want the social login buttons to appear. Also please note that for this to work you will need to be sure that the AddShoppers widget JS (step 1) is loaded on the page also (if its in the global footer it should be fine).

<!-- Some social login buttons, you can delete these or add different ones from your AddShoppers dashboard under Apps > Social Login -->
<div class="social-commerce-signin-facebook" data-style="logoandtext" data-size="medium"></div>
<div class="social-commerce-signin-google" data-style="logoandtext" data-size="medium"></div>
<div class="social-commerce-signin-linkedin" data-style="logoandtext" data-size="medium"></div>

<script type="text/javascript">
        function init() {
            AddShoppersWidget.API.Event.bind("sign_in", createAccount);

        function createAccount(params) {
            if (params.source == "social_login") {
                var data = AddShoppersWidget.API.User.signed_data();
                var loc = "/create.php?as_signature=" + JSON.stringify(data);
                    type: "POST",
                    async: true,
                    url: loc,
                    data:  { 'direction': 'up' },
                    dataType: "json",
                    contentType: "application/json; charset=utf-8",
                    success: function (msg) { location.reload() },
                    error: function (err){ }
        if (window.addEventListener) {                        
            window.addEventListener("load", init, false); 
        else {
            document.onreadystatechange = function() { 
                if(document.readyState in {loaded: 1, complete: 1}) {
                    document.onreadystatechange = null;