For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
My website is Hobbystories.com. There are constant requests to cart.js, every second, I can't figure out what this is about. Is it supposed to be like this? If not, help me fix it.
Solved! Go to the solution
This is an accepted solution.
Hi @Alex2094
I'm not entirely sure what's causing it. Have you had any custom work done on the site - or just installed apps?
It's this bit of code that's causing the call:
var orichiCartItemCount = -1;
setInterval(function() {
if (window.pixels != undefined && window.pixels.length > 0) {
//debugger;
$.ajax({
type: 'GET',
url: '/cart.js',
dataType: 'json'
}).done(cart => {
if (cart.item_count > 0 && orichiCartItemCount != -1 && cart.item_count > orichiCartItemCount) {
//debugger;
var lastItem = cart.items[0];
let event_id = (new Date()).getTime() + getRandomInt(1, 100000);
window.pixels.forEach(function(pixel, index) {
let pixelID = pixel.FacebookPixel;
orfbq(`${pixelID}`, 'AddToCart', {
content_ids: lastItem['product_id'],
content_type: 'product_group',
value: parseInt(cart.total_price) / 100,
content_name: lastItem['product_title'],
currency: currency,
}, event_id, pixel);
})
};
orichiCartItemCount = cart.item_count;
}).fail(function(jqXHR, textStatus) {
orichiCartItemCount = -1;
});
}
}, 1000);
A quick search on "Orichi Shopify" shows these apps:
https://apps.shopify.com/partners/orichi
Do you have either of those installed?
This is an accepted solution.
Hi @Alex2094
I'm not entirely sure what's causing it. Have you had any custom work done on the site - or just installed apps?
It's this bit of code that's causing the call:
var orichiCartItemCount = -1;
setInterval(function() {
if (window.pixels != undefined && window.pixels.length > 0) {
//debugger;
$.ajax({
type: 'GET',
url: '/cart.js',
dataType: 'json'
}).done(cart => {
if (cart.item_count > 0 && orichiCartItemCount != -1 && cart.item_count > orichiCartItemCount) {
//debugger;
var lastItem = cart.items[0];
let event_id = (new Date()).getTime() + getRandomInt(1, 100000);
window.pixels.forEach(function(pixel, index) {
let pixelID = pixel.FacebookPixel;
orfbq(`${pixelID}`, 'AddToCart', {
content_ids: lastItem['product_id'],
content_type: 'product_group',
value: parseInt(cart.total_price) / 100,
content_name: lastItem['product_title'],
currency: currency,
}, event_id, pixel);
})
};
orichiCartItemCount = cart.item_count;
}).fail(function(jqXHR, textStatus) {
orichiCartItemCount = -1;
});
}
}, 1000);
A quick search on "Orichi Shopify" shows these apps:
https://apps.shopify.com/partners/orichi
Do you have either of those installed?
Yes, I have the Facebook Pixels Conversion API app installed, thanks for your help!
Per @SB_90 sample, it's analytics code doing exactly what it needs to for it to be able to track conversions of what users are putting in the cart.
The calls sizes are very small and can be ignored for the most part , If you want to over optimize performance you would need to deeply integrate the apps code with the themes cart javascript so the calls only happen when users change the cart.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org