APIs & Integrations

Greg_Moore
Member

Abandoned Cart Event Guidance

We noticed that our successful abandoned cart email campaign is no longer sending. Nothing was changed with the event or email. We have not had an order from this email since August 1. In mid-October, we switched to SSL / HTTPS. The HubSpot technical consulting team took a look and nothing struck out. Here is the event code. Anyone notice anything?

Thank you!

window.updateHubSpotCart = function (cart) {
var _hsq = window._hsq = window._hsq || [];

var hubspotObj = {},
    jbUrl = 'http://www.justbats.com/',
    jbgUrl = 'http://www.justballgloves.com/';

// Set Session ID
hubspotObj.cart_sessionid = cart.SessionId;

for (var x = 0; x < 3; x++) {
    var site = '',
        index = x + 1;

    // Limit to First 3 items in Cart
    if (x < cart.LineItems.length) {
        (cart.LineItems[x].ProductType === "Glove") ? site = jbgUrl : site = jbUrl;

        hubspotObj["cart_product_" + index + "_name"] = cart.LineItems[x].ProductName;
        hubspotObj["cart_product_" + index + "_image"] = site.replace('/www.', '/images.') + cart.LineItems[x].ImagePath;
        hubspotObj["cart_product_" + index + "_link"] = site + 'product/' + cart.LineItems[x].ProductNameUrlFriendly + '/' + cart.LineItems[x].ProductId + '/';
        hubspotObj["cart_product_" + index + "_price"] = cart.LineItems[x].PriceEach;
    } else {
        hubspotObj["cart_product_" + index + "_name"] = 'n/a';
        hubspotObj["cart_product_" + index + "_image"] = 'n/a';
        hubspotObj["cart_product_" + index + "_link"] = 'n/a';
        hubspotObj["cart_product_" + index + "_price"] = 0;
    }
}

_hsq.push(["identify", hubspotObj]);
_hsq.push(["trackEvent", { id: '000000529216' }]);

}

0 Upvotes
1 Reply 1
jmsbrr
Participant

Abandoned Cart Event Guidance

Hi Greg,

You mentioned you switched to HTTPS but the protocol in jbUrl and jbgUrl is http.

They should be updated to https:

jbUrl = 'https://www.justbats.com/',
jbgUrl = 'https://www.justballgloves.com/';

This may or may not be the issue, depending if you have set up redirection on your server from http:// to https://

James