# Shopify Advanced

> Set up Shopify Advanced conversion tracking with AnyTrack to track purchases, cart events, and revenue. Connect your store data to ad platforms for accurate attribution and ROAS optimization.

## Client-Side Tracking Settings

> 📘 **Note**
>
> **Client-side tracking** relates to website events that are tracked in the browser via the AnyTrack Tracking Tag. For example: `AddToCart`, or `InitiateCheckout`, or `FormSubmit`.
>
> **Client-side** <a href='/docs/property'>settings</a> are located in the **Property Settings** > **settings**

When enabling client-side tracking you gain more control over the checkout data collection which lets you enrich your Tracking Tag via the server-side integration.

* **URL parameter:** This allows AnyTrack to pass and read unique tracking parameters through your funnel.
* **Hidden parameters:** AnyTrack passes a unique tracking parameter into the cart's standard hidden fields. This option guarantees maximum tracking accuracy.

> 📘 **Note**
>
> For best results, we recommend that both options be turned on.

<Prerequisites
  title="Before you begin"
  items={[
    { label: "You have an AnyTrack account with a paid subscription", done: true },
    { label: "You have a Shopify store connected to AnyTrack", done: true },
    { label: "The AnyTrack Tracking Tag is installed on your website", done: true },
  ]}
/>

### Client-Side Tracking Events

* AnyTrack uses client-side tracking events to capture product data.
* AnyTrack deduplicates these events with the server-side events.
* AnyTrack then sends the events through the Conversion API of your ads integrations.

<Image align="center" alt="AnyTrack and Shopify integration for client side tracking" border={true} caption="AnyTrack default Client Side Tracking settings for Shopify" src={readmeAsset1} width="600px" />

> 📘 **Note**
>
> The `Purchase` event is disabled by default since server-side tracking is more reliable and provides richer data.

## Troubleshooting

### Tracking Not Working After Changing Shopify Theme

When you switch, change, or reinstall your Shopify theme, the theme code is rewritten, which removes the AnyTrack Tracking Tag. You can easily restore tracking by following these steps:

#### Reinstall the AnyTrack Tag

1. From your AnyTrack dashboard, navigate to the Property Settings section for your Shopify store and select the 'Tracking Script' tab.

   <Image align="center" alt="Find the AnyTrack Tag in the Property Settings." border={true} caption="Find the AnyTrack Tag in the Property Settings Section" src={readmeAsset2} />

2. Click on the tag to copy it to your clipboard.

3. From your Shopify dashboard, navigate to 'Online Store', click on the three dots button, and select 'Edit Code'.

4. In the 'Layout' folder, select the 'theme.liquid' file.

5. Paste the AnyTrack Tracking Tag before the closing `</head>` tag.

6. Save your changes.

<Video align="center" alt="Paste the AnyTrack Tag in the head section of the theme.liquid file." border={true} caption="Paste the AnyTrack Tag in the head of the theme.liquid file." src={readmeAsset3} />

### Validation

Use the [AnyTrack Pixel Helper](/docs/anytrack-chrome-extension) Chrome extension to verify if the AnyTrack Tracking Tag is now correctly detected on your Shopify store.

<FaqAccordion
  title="Shopify Advanced - Frequently Asked Questions"
  icon="fa-duotone fa-circle-question"
  items={[
    {
      question: "What is the difference between client-side and server-side tracking?",
      answer: "Client-side tracking captures events in the browser via the AnyTrack Tracking Tag (for example, AddToCart and InitiateCheckout). Server-side tracking captures events via Shopify Webhooks and sends them directly to your ad platforms via Conversion API. AnyTrack uses both methods together and deduplicates the data automatically."
    },
    {
      question: "Why is the Purchase event disabled in client-side tracking by default?",
      answer: "The Purchase event is captured more reliably via Shopify Webhooks (server-side). Server-side tracking is not affected by browser extensions or JavaScript errors, making it the preferred method for purchase data. Enabling it client-side as well would require deduplication to avoid double-counting."
    },
    {
      question: "Do I need to reinstall the AnyTrack Tag after updating my Shopify theme?",
      answer: "Yes. When you switch or reinstall a Shopify theme, the theme.liquid file is rewritten and the AnyTrack Tracking Tag is removed. Follow the Reinstall the AnyTrack Tag steps above to restore tracking after any theme change."
    }
  ]}
/>

---

## Related Resources

- [Install AnyTrack Tag](/docs/install-anytrack-tag)
- [Shopify Integration Setup](/docs/shopify)
- [Shopify Setup Checklist](/docs/shopify-checklist)
