Développeurs
Shopify : démarrage rapide
Les étapes d'installation et de première utilisation pour envoyer des événements à Feralin avec Shopify. Les exemples de code viennent du README du SDK et les statuts du registre des capacités.
Installation
Aucun paquet publié sur Shopify App Store n'a encore été vérifié ; les étapes ci-dessous installent depuis le code source ou depuis un paquet local.
<script src="https://feralin.com/sdk/feralin.iife.js" defer></script>
<script>
(function () {
var hazir = false;
function izniUygula() {
var gizlilik = window.Shopify.customerPrivacy;
feralin.setConsent({ analytics: gizlilik.analyticsProcessingAllowed(), advertising: gizlilik.marketingAllowed() });
}
window.feralinOlay = function (ad, ozellikler) {
if (!hazir) return null;
var kopya = Object.assign({}, ozellikler);
if (feralin.getStatus().consent.advertising !== true) delete kopya.fr_click;
return feralin.track(ad, kopya);
};
window.addEventListener("load", function () {
feralin.initialize({ projectKey: "pk_live_BURAYA", collectUrl: "https://feralin.com/collect" });
hazir = true;
window.Shopify.loadFeatures([{ name: "consent-tracking-api", version: "0.2" }], function (hata) {
if (hata) return;
izniUygula();
document.addEventListener("visitorConsentCollected", izniUygula);
});
});
})();
</script>Première utilisation
var izin = init.customerPrivacy;
api.customerPrivacy.subscribe("visitorConsentCollected", function (olay) {
izin = olay.customerPrivacy;
});
analytics.subscribe("checkout_completed", function (olay) {
if (!izin.analyticsProcessingAllowed) return;
var odeme = olay.data.checkout;
if (!odeme.order || !odeme.order.id) return;
var kimlik = ("shopify-" + odeme.order.id).replace(/[^0-9A-Za-z-]/g, "-").slice(0, 64);
fetch("https://feralin.com/collect/v1/batch", {
method: "POST",
keepalive: true,
headers: { "Content-Type": "application/json", "X-Feralin-Project-Key": "pk_live_BURAYA", "Idempotency-Key": kimlik },
body: JSON.stringify({
events: [
{
event_id: kimlik,
event_name: "order_completed",
occurred_at: new Date().toISOString(),
platform: "other",
schema_version: 1,
consent: { analytics: true, advertising: izin.marketingAllowed === true },
properties: {
order_id: String(odeme.order.id),
value: odeme.totalPrice ? odeme.totalPrice.amount : undefined,
currency: odeme.totalPrice ? odeme.totalPrice.currencyCode : undefined,
},
},
],
}),
});
});Les exemples de code sont repris tels quels de docs/sdk/no-code.md ; les commentaires peuvent y être en turc. La clé de projet se crée depuis la console.
Capacités
| Capacité | Statut |
|---|---|
| Envoi d'événements | Partiel |
| Envoi par lots | Partiel |
| Gestion du consentement | Partiel |
| Identité | Partiel |
| Attribution | Partiel |
| Liens profonds | Sans objet |
| Revenus | Prévu |
| Capture des erreurs | Sans objet |
| Session replay | Sans objet |
| Traçage | Sans objet |
Chaîne de vérification
| Maillon | Statut |
|---|---|
| Code source | Partiel |
| Compilation | Sans objet |
| Tests | Réussi |
| Publication sur le registre | En attente d'un accès externe |
| Installation propre | En attente d'un accès externe |
| Réception de l'événement | Partiel |
| Documentation | Réussi |
| Preuve Super Admin | Non commencé |
Réussi signifie preuve locale : le code source, la compilation et les tests ont été exécutés. La publication sur le registre et la preuve Super Admin sont des maillons distincts ; tant que l'un n'est pas franchi, le SDK n'est pas considéré comme prêt.