# Standard-Events ändern

Mit Pixel Your Shop ist es möglich die Standard-Events für alle Pixel mit eigenem dynamischen Code komplett zu überschreiben. Dadurch sind auch spezielle Konfigurationen und Kundenwünsche möglich, die mit herkömmlichen Plugins nur schwer oder garnicht umzusetzten sind.

{% hint style="info" %}
**Tipp**

Du kannst die folgenden Schritte jeweils pro Verkaufskanal & Sprache einzeln konfigurieren, was dir schlussendlich mehr Flexibilität während der Entwicklung ermöglicht.
{% endhint %}

### Kurze Erklärung <a href="#kurze-erklarung" id="kurze-erklarung"></a>

Jeder Pixel-Code wird im Frontend dynamisch mit Twig erzeugt. Twig ist eine einfache Template-Sprache, die in diesem Fall den eigentlichen Javascript Code für das Tracking erzeugt, den der Endbenutzer des Shops letztendlich auslöst.

Der Vorteil von Twig ist, dass dynamische Variablen wie z.B. `products` benutzt werden können, die bei der Erzeugung des Tracking-Codes die richtigen Produktdaten enthalten. Durch den flexiblen Aufbau kann man ohne Probleme einzelne Code-Zeilen oder auch komplette Skripte ersetzten.

Um den Code editieren zu können, muss man bei den Opt-In- & Event-Boxen auf das `Zahnrad-Symbol` klicken und dann den Schalter `Eigenen Code verwenden` aktivieren.

![](/files/-Mj0GrqUWhPtqKTiLUKu)

### Opt-In Variablen <a href="#opt-in-variablen" id="opt-in-variablen"></a>

Hier gibt es eine Auflistung der Twig-Variablen, die während des Opt-Ins verwendet werden können:

|        Pixel       |           Variable           |  Typ  |       Beispiel       |
| :----------------: | :--------------------------: | :---: | :------------------: |
|     Google gtag    |  googleAnalyticsTrackingIds  | array | `['UA-xxxxxxxxx-x']` |
|     Google gtag    |    googleAdsConversionIds    | array |  `['AW-xxxxxxxxx']`  |
|     Google gtag    |       googleAnonymizeIp      |  bool |        `true`        |
| Google Tag Manager | googleTagManagerContainerIds | array |  `['GTM-xxxxxxxx']`  |
|      Facebook      |       facebookPixelIds       | array |   `['xxxxxxxxxx']`   |
|       Hotjar       |           hotjarIds          | array |    `['xxxxxxxx']`    |

### Event Variablen <a href="#event-variablen" id="event-variablen"></a>

Hier findest du eine Auflistung der Twig-Variablen aufgelistet pro Event:

#### Add to card <a href="#add-to-card" id="add-to-card"></a>

|  Variable  |  Type |                            Example                           |
| :--------: | :---: | :----------------------------------------------------------: |
|  products  | array | `[{ number: 'xxxxx', name: 'Burger', priceNet: 9.99, ... }]` |
| totalPrice |  int  |                            `9.99`                            |

#### Begin checkout <a href="#begin-checkout" id="begin-checkout"></a>

|   Variable  |      Type      |                            Example                           |
| :---------: | :------------: | :----------------------------------------------------------: |
| affiliation | string or null |                 `affiliateCode/campaignCode`                 |
|    coupon   | string or null |                        `christmas_10`                        |
|   products  |      array     | `[{ number: 'xxxxx', name: 'Burger', priceNet: 9.99, ... }]` |
|  totalPrice |       int      |                            `9.99`                            |

#### Click product <a href="#click-product" id="click-product"></a>

| Variable |  Type  |                           Example                          |
| :------: | :----: | :--------------------------------------------------------: |
|  product | object | `{ number: 'xxxxx', name: 'Burger', priceNet: 9.99, ... }` |

#### Login <a href="#login" id="login"></a>

| Variable |      Type      | Example |
| :------: | :------------: | :-----: |
|  method  | string or null | `Login` |

#### Purchase <a href="#purchase" id="purchase"></a>

|   Variable  |      Type      |                            Example                           |
| :---------: | :------------: | :----------------------------------------------------------: |
| orderNumber |     string     |                           `'xxxxx'`                          |
|   shipping  |       int      |                            `2.99`                            |
| affiliation | string or null |                 `affiliateCode/campaignCode`                 |
|    coupon   | string or null |                        `christmas_10`                        |
|   products  |      array     | `[{ number: 'xxxxx', name: 'Burger', priceNet: 9.99, ... }]` |
|  totalPrice |       int      |                            `9.99`                            |
|   totalTax  |       int      |                            `9.99`                            |

#### Register <a href="#register" id="register"></a>

| Variable |      Type      |  Example  |
| :------: | :------------: | :-------: |
|  method  | string or null | `'Login'` |

#### Remove from card <a href="#remove-from-card" id="remove-from-card"></a>

|  Variable  |  Type |                            Example                           |
| :--------: | :---: | :----------------------------------------------------------: |
|  products  | array | `[{ number: 'xxxxx', name: 'Burger', priceNet: 9.99, ... }]` |
| totalPrice |  int  |                            `9.99`                            |

#### Search <a href="#search" id="search"></a>

|  Variable  |  Type  |       Example      |
| :--------: | :----: | :----------------: |
| searchTerm | string | `'My search term'` |

#### View product <a href="#view-product" id="view-product"></a>

| Variable |  Type  |                           Example                          |
| :------: | :----: | :--------------------------------------------------------: |
|  product | object | `{ number: 'xxxxx', name: 'Burger', priceNet: 9.99, ... }` |

#### View product list <a href="#view-product-list" id="view-product-list"></a>

|  Variable  |  Type |                            Example                           |
| :--------: | :---: | :----------------------------------------------------------: |
|  products  | array | `[{ number: 'xxxxx', name: 'Burger', priceNet: 9.99, ... }]` |
| totalPrice |  int  |                            `9.99`                            |

#### View product search <a href="#view-product-search" id="view-product-search"></a>

|  Variable  |  Type  |                            Example                           |
| :--------: | :----: | :----------------------------------------------------------: |
|  products  |  array | `[{ number: 'xxxxx', name: 'Burger', priceNet: 9.99, ... }]` |
| totalPrice |   int  |                            `9.99`                            |
| searchTerm | string |                      `'My search term'`                      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shop-studio.io/shopware/de/erweiterungen/pixelyourshop/development/change-default-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
