<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [DefaultExternalTaggingService](./x-components.defaultexternaltaggingservice.md) &gt; [trackAddToCart](./x-components.defaultexternaltaggingservice.trackaddtocart.md)

## DefaultExternalTaggingService.trackAddToCart() method

Checks if the session storage contains a result information for a given id or the current url. If exists, it tracks the add to cart and saves the add to cart information into session storage.

**Signature:**

```typescript
trackAddToCart(id?: string): void;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

id


</td><td>

string


</td><td>

_(Optional)_ The id of the result to track.


</td></tr>
</tbody></table>

**Returns:**

void

