CMS Development

WShek
Member

Implementing PartyTown to Theme

SOLVE

Hi,

 

do you have any idea on how to implement PartyTown to a HubSpot theme? 

 

Specifically, I am stuck at the steps where PartyTown requires the files to live in the /~partytown/ folder but HubSpot requires get_assets_url() function to locate the files. 

 

Party Docs: https://partytown.builder.io/

 

Thanks!

0 Upvotes
1 Accepted solution
albertsg
Solution
Guide

Implementing PartyTown to Theme

SOLVE

Hi @WShek, I'm not familiar with PartyTown but based on their documentation seems like the only thing you need to do is add the script inside your <head> tag. 

<head>
  <script>
    /* Inlined Partytown Snippet */
  </script>
  <script type="text/partytown" src="https://example.com/analytics.js"></script>
</head>


You should be able to find your base.html template (or similar) and add the snippet there. You can also do it directly from the Settings of your HubSpot account as shown here, without the need to update the code and deploy the updates.

See: https://partytown.builder.io/html 



Did my answer help you? Mark it as a solution

View solution in original post

2 Replies 2
albertsg
Solution
Guide

Implementing PartyTown to Theme

SOLVE

Hi @WShek, I'm not familiar with PartyTown but based on their documentation seems like the only thing you need to do is add the script inside your <head> tag. 

<head>
  <script>
    /* Inlined Partytown Snippet */
  </script>
  <script type="text/partytown" src="https://example.com/analytics.js"></script>
</head>


You should be able to find your base.html template (or similar) and add the snippet there. You can also do it directly from the Settings of your HubSpot account as shown here, without the need to update the code and deploy the updates.

See: https://partytown.builder.io/html 



Did my answer help you? Mark it as a solution
steve_rogers56
Member

Implementing PartyTown to Theme

SOLVE

To implement PartyTown in a HubSpot theme, use HubSpot's get_assets_url() to reference files stored in your custom directory. You’ll need to set up a path that points to the /~partytown/ folder manually in your theme's HTML or JavaScript. Once that’s done, initialize PartyTown with its iframe settings and ensure all paths are aligned correctly to avoid conflicts. Make sure to test everything to confirm it works as expected.