店匠Google渠道无法选择账户
原因:目前受到google第三方后台的影响暂时无法选定账号,需要去google后台进行设置
第一步是在ADS后台创建对应的转化事件
1、创建转化
登录Google ads后台-转化-新建转化操作
选择网站-输入网址链接-扫描
手动添加转化操作
1、类别可以选择转化的事件,例如加购、开始结账、购买等事件
2、转化名称:自行设置
3、价值:勾选为每次转化使用不同的价值
4、统计方式:每一次
其他配置默认即可
然后点击保存并继续,点击查看事件代码即可看到对应转化的ID和label。
第二步、添加代码
把以下代码添加在自定义代码嵌入插件内,页面选择全部,代码位置可以选择顶部或者底部。
注意:
a、需要将文档中{}括起来的部分以及括号本身用真实ID进行替换,包含:{AW-开头的ID}、{AW-开头的ID}/{页面访问label}、{AW-开头的ID}/{商品浏览label} 、{AW-开头的ID}/{商品搜搜label}、{AW-开头的ID}/{加购label}、{AW-开头的ID}/{开始结账label}、{AW-开头的ID}/{添加支付方式label}、{AW-开头的ID}/{支付成功label}
(不同的转化有不同的label,在代码里对应位置需替换为对应转化的label)
b、不同转化类型用注释标注了代码的开始与结束 可以自行对标注的代码片段进行删除
以下是相关代码
<!-- google-ads-conversion-start -->
<script async src="https://www.googletagmanager.com/gtag/js?id={AW-开头的ID}"></script>
<script type="application/javascript">
!(function () {
'use strict';
try {
var e = (window.ORDER && window.ORDER.customer) || {},
n = (window.ORDER && window.ORDER.billing_address) || {};
(window.enhanced_conversion_data = {
email: e.email || '',
phone_number: e.phone || '',
first_name: n.first_name || '',
last_name: n.last_name || '',
home_address: {
street: n.street || '',
city: n.city || '',
region: n.province || '',
postal_code: n.zip || '',
country: n.country_code || '',
},
}),
(window.dataLayer = window.dataLayer || []),
(window.gtag = function () {
window.dataLayer.push(arguments);
});
var t =
((i = new RegExp('(^| )' + 'client_id' + '=([^;]*)(;|$)')),
(d = document.cookie.match(i)) ? decodeURIComponent(d[2]) : ''),
a = { enhanced_conversion: false } || {};
(a.user_id = t),
gtag('js', new Date()),
gtag('config', '{AW-开头的ID}', a),
(window.ADS_ID_FORMAT = 'gtag_variant_id'),
(window.ADS_COUNTRY = 'US'),
(o = function () {
var e = window.SHOPLAZZA.currency_code || 'USD',
n = 'gtag_variant_id' === window.ADS_ID_FORMAT,
a = 'shoplaza_' + (window.ADS_COUNTRY || 'US') + '_',
googleConversionFn = { keepThisObj: function () {} };
googleConversionFn.keepThisObj(),
[
//Pageview 页面访问 开始
!(function () {
var e = {
d: function (o, n) {
for (var r in n)
e.o(n, r) && !e.o(o, r) && Object.defineProperty(o, r, { enumerable: !0, get: n[r] });
},
o: function (e, o) {
return Object.prototype.hasOwnProperty.call(e, o);
},
r: function (e) {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(e, '__esModule', { value: !0 });
},
},
o = {};
!(function () {
'use strict';
function n(e) {
var o = e.clientId;
gtag('event', 'conversion', { send_to: '{AW-开头的ID}/{页面访问label}', user_id: o });
}
e.r(o),
e.d(o, {
pageView: function () {
return n;
},
});
})();
var n = (googleConversionFn = 'undefined' == typeof googleConversionFn ? {} : googleConversionFn);
for (var r in o) n[r] = o[r];
o.__esModule && Object.defineProperty(n, '__esModule', { value: !0 });
})(),
//Pageview 页面访问 结束
//dj.viewContent 查看商品 开始
!(function () {
var e = {
d: function (n, o) {
for (var t in o)
e.o(o, t) && !e.o(n, t) && Object.defineProperty(n, t, { enumerable: !0, get: o[t] });
},
o: function (e, n) {
return Object.prototype.hasOwnProperty.call(e, n);
},
r: function (e) {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(e, '__esModule', { value: !0 });
},
},
n = {};
!(function () {
'use strict';
function o(e) {
e.includes(window.SHOPLAZZA.shop.shop_id);
}
e.r(n),
e.d(n, {
viewItem: function () {
return i;
},
});
const t = [39229];
function i(e) {
var n,
i,
r,
d = e.gtagVariantId,
u = e.adsCountry,
c = e.clientId,
a = !1;
document.body.addEventListener(
'dj.viewContent',
((n = function (e, n) {
if (
((n = e.detail),
!o(t) || !('dj.product.variants.change' === n.source || ('pageview' === n.source && a)))
) {
var i = n.selected.id || n.product.variants[0].id;
gtag('event', 'conversion', {
send_to: '{AW-开头的ID}/{商品浏览label}',
user_id: c,
items: [{ id: d ? u + i : n.product.id }],
}),
o(t) && 'pageview' === n.source && (a = !0);
}
}),
(i = 500),
function () {
var e = this,
o = arguments;
clearTimeout(r),
(r = setTimeout(function () {
n.apply(e, o);
}, i));
})
);
}
})();
var o = (googleConversionFn = 'undefined' == typeof googleConversionFn ? {} : googleConversionFn);
for (var t in n) o[t] = n[t];
n.__esModule && Object.defineProperty(o, '__esModule', { value: !0 });
})(),
//dj.viewContent 查看商品 结束
//dj.productSearch 商品搜索 开始
!(function () {
var e = {
d: function (o, n) {
for (var r in n)
e.o(n, r) && !e.o(o, r) && Object.defineProperty(o, r, { enumerable: !0, get: n[r] });
},
o: function (e, o) {
return Object.prototype.hasOwnProperty.call(e, o);
},
r: function (e) {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(e, '__esModule', { value: !0 });
},
},
o = {};
!(function () {
'use strict';
e.r(o),
e.d(o, {
search: function () {
return r;
},
});
const n = [39229];
function r(e) {
var o = e.clientId;
document.body.addEventListener('dj.productSearch', function (e, r) {
if (
((r = e.detail), !void n.includes(window.SHOPLAZZA.shop.shop_id) || 'pageview' === r.source)
) {
var t = r.keyWord;
try {
t || (t = new URLSearchParams(location.search || '?').get('q'));
} catch (e) {}
gtag('event', 'conversion', {
send_to: '{AW-开头的ID}/{商品搜搜label}',
user_id: o,
search_keyword: t,
});
}
});
}
})();
var n = (googleConversionFn = 'undefined' == typeof googleConversionFn ? {} : googleConversionFn);
for (var r in o) n[r] = o[r];
o.__esModule && Object.defineProperty(n, '__esModule', { value: !0 });
})(),
//dj.productSearch 商品搜索 结束
//dj.addToCart 加入购物车 开始
!(function () {
var e = {
d: function (n, o) {
for (var t in o)
e.o(o, t) && !e.o(n, t) && Object.defineProperty(n, t, { enumerable: !0, get: o[t] });
},
o: function (e, n) {
return Object.prototype.hasOwnProperty.call(e, n);
},
r: function (e) {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(e, '__esModule', { value: !0 });
},
},
n = {};
!(function () {
'use strict';
function o(e) {
var n = e.currency,
o = e.gtagVariantId,
t = e.adsCountry,
r = e.clientId;
window.ADS_ADD_TO_CART ||
((window.ADS_ADD_TO_CART = !0),
document.body.addEventListener('dj.addToCart', function (e, i) {
(i = e.detail),
gtag('event', 'conversion', {
send_to: '{AW-开头的ID}/{加购label}',
user_id: r,
currency: n,
items: [{ id: o ? t + i.variant_id : i.id, quantity: i.number || 1, price: i.item_price }],
});
}));
}
e.r(n),
e.d(n, {
addToCart: function () {
return o;
},
});
})();
var o = (googleConversionFn = 'undefined' == typeof googleConversionFn ? {} : googleConversionFn);
for (var t in n) o[t] = n[t];
n.__esModule && Object.defineProperty(o, '__esModule', { value: !0 });
})(),
//dj.addToCart 加入购物车 结束
//dj.purchase 开始结账 开始
!(function () {
var e = {
d: function (n, o) {
for (var t in o)
e.o(o, t) && !e.o(n, t) && Object.defineProperty(n, t, { enumerable: !0, get: o[t] });
},
o: function (e, n) {
return Object.prototype.hasOwnProperty.call(e, n);
},
r: function (e) {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(e, '__esModule', { value: !0 });
},
},
n = {};
!(function () {
'use strict';
function o(e) {
var n = e.currency,
o = e.gtagVariantId,
t = e.adsCountry,
i = e.clientId;
document.body.addEventListener('dj.initiateCheckout', function (e, r) {
(r = e.detail),
gtag('event', 'conversion', {
send_to: '{AW-开头的ID}/{开始结账label}',
user_id: i,
currency: n,
transaction_id: r.id,
items: r.line_items.map(function (e) {
return { id: o ? t + e.variant_id : e.product_id, quantity: e.quantity, price: e.price };
}),
});
});
}
e.r(n),
e.d(n, {
beginCheckout: function () {
return o;
},
});
})();
var o = (googleConversionFn = 'undefined' == typeof googleConversionFn ? {} : googleConversionFn);
for (var t in n) o[t] = n[t];
n.__esModule && Object.defineProperty(o, '__esModule', { value: !0 });
})(),
//dj.purchase 开始结账 结束
//dj.checkoutStepPayment 增加支付方式 开始
!(function () {
var e = {
d: function (n, o) {
for (var t in o)
e.o(o, t) && !e.o(n, t) && Object.defineProperty(n, t, { enumerable: !0, get: o[t] });
},
o: function (e, n) {
return Object.prototype.hasOwnProperty.call(e, n);
},
r: function (e) {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(e, '__esModule', { value: !0 });
},
},
n = {};
!(function () {
'use strict';
function o(e) {
var n = e.gtagVariantId,
o = e.adsCountry,
t = e.currency,
r = e.clientId;
document.body.addEventListener('dj.checkoutStepPayment', function (e, i) {
(i = e.detail),
gtag('event', 'conversion', {
send_to: '{AW-开头的ID}/{添加支付方式label}',
user_id: r,
currency: t,
items: i.line_items.map(function (e) {
return { id: n ? o + e.variant_id : e.product_id };
}),
});
});
}
e.r(n),
e.d(n, {
payment: function () {
return o;
},
});
})();
var o = (googleConversionFn = 'undefined' == typeof googleConversionFn ? {} : googleConversionFn);
for (var t in n) o[t] = n[t];
n.__esModule && Object.defineProperty(o, '__esModule', { value: !0 });
})(),
//dj.checkoutStepPayment 增加支付方式 结束
//dj.purchase 订单完成 开始
!(function () {
var e = {
d: function (n, o) {
for (var t in o)
e.o(o, t) && !e.o(n, t) && Object.defineProperty(n, t, { enumerable: !0, get: o[t] });
},
o: function (e, n) {
return Object.prototype.hasOwnProperty.call(e, n);
},
r: function (e) {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(e, '__esModule', { value: !0 });
},
},
n = {};
!(function () {
'use strict';
function o(e) {
var n = e.gtagVariantId,
o = e.adsCountry,
t = e.currency,
r = e.clientId;
document.body.addEventListener('dj.purchase', function (e, i) {
(i = e.detail),
gtag('event', 'conversion', {
send_to: '{AW-开头的ID}/{支付成功label}',
user_id: r,
value: i.prices.total_price,
currency: t,
transaction_id: i.id,
items: i.line_items.map(function (e) {
return { id: n ? o + e.variant_id : e.product_id, quantity: e.quantity, price: e.price };
}),
});
});
}
e.r(n),
e.d(n, {
purchase: function () {
return o;
},
});
})();
var o = (googleConversionFn = 'undefined' == typeof googleConversionFn ? {} : googleConversionFn);
for (var t in n) o[t] = n[t];
n.__esModule && Object.defineProperty(o, '__esModule', { value: !0 });
})(),
//dj.purchase 订单完成 结束
].forEach(function () {}),
Object.values(googleConversionFn).forEach(function (o) {
return o({ currency: e, gtagVariantId: n, adsCountry: a, clientId: t });
});
}),
'loading' !== document.readyState
? setTimeout(o)
: document.addEventListener('DOMContentLoaded', function e() {
document.removeEventListener('DOMContentLoaded', e), o();
});
} catch (e) {}
var o, i, d;
})();
</script>
<!-- google-ads-conversion-end -->