---
title: Script Barındırma ve Entegrasyon
description: Create a doc page with rich content.
sidebar_position: 5
---

## Dosyayı Host Edip / ikas’a Linkini Eklemek

Oluşturulan JavaScript dosyası, harici bir hosting servisi üzerinden servis edilmelidir. Tercih edilebilecek hosting seçenekleri:

-   Vercel
-   Netlify
-   AWS S3
-   Google Cloud Storage
-   Azure Blob Storage

### ikas Tema Entegrasyonu

Script dosyası host edildikten sonra, ikas temasına `CreateStorefrontJSScript` mutation'ı kullanılarak veya ikas Yönetim Paneli Eklentiler kısmından entegre edilmelidir. Her müşteri için benzersiz bir `publicApiKey` kullanılabilir.

### Headers

```
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
```

### GraphQL Mutation

```graphql
mutation CreateStorefrontJSScript($input: CreateStorefrontJSScriptInput!) {
  createStorefrontJSScript(input: $input) {
    authorizedAppId
    contentType
    createdAt
    deleted
    fileName
    id
    isActive
    isHighPriority
    name
    order
    scriptContent
    storeAppId
    storefrontId
    updatedAt
  }
}
```

### Variables

```json
{
  "input": {
    "storefrontId": "YOUR_STOREFRONT_ID",
    "scriptContent": "<script src=\\\\"<https://your-hosting.com/custom-handler.js?publicApiKey=YOUR_UNIQUE_KEY\\\\"></script>">,
    "name": "CustomEventHandler",
    "isHighPriority": false, //Script taginin en üstte çağrılmasını istiyorsanız kullanılabilir, Cookie vs uygulamaları için.
    "fileName": null,
    "contentType": "SCRIPT",
  }
}
```


### Müşteriye Özel Yapılandırma

1.  **PublicApiKey Kullanımı**:
    
    -   Her müşteri için benzersiz bir `publicApiKey` oluşturululabilir.
    -   API Key script URL'inde query parametresi olarak geçirilir
    -   Bu key ile müşteriye özel event tracking yapılandırması sağlanır
    
    **Önemli Noktalar**:
    

-   `scriptContent` içinde tam `script` tag'i kullanılmalıdır
-   URL'ler encode edilmiş olmalıdır
-   Query parametreleri URL'in bir parçası olarak eklenir
-   Her müşteri için benzersiz bir `publicApiKey` kullanılması önerilir