Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
How to call the function in another component from an external javascript src in next.js

So I am new to next.js and I want to integrate an external javascript src file into my next.js app. Something like this

<script type="text/javascript">
src="//static.powerreviews.com/t/v1/tracker.js"></script>

<script type="text/javascript">
   (function(){try{

   var tracker = POWERREVIEWS.tracker.createTracker({
    merchantGroupId: 'MERCHANT_GROUP_ID'});

    var orderFeed = {
        merchantGroupId: 'MERCHANT_GROUP_ID',
        merchantId: 'MERCHANT_ID',
        locale: 'LOCALE',
        merchantUserId: 'INTERNAL CUSTOMER_ID',
        marketingOptIn: true,
        userEmail: 'CUSTOMER_EMAIL ADDRESS',
        userFirstName: 'CUSTOMER FIRST_NAME',
        userLastName: 'CUSTOMER LAST_NAME',
        orderId: 'ORDER_ID',
        orderItems: [{
            page_id: 'PAGE_ID_1',
            product_name: 'PRODUCT_NAME_1',
            quantity: QUANTITY,
            unit_price: PRICE
        }, {
            page_id: 'PAGE_ID_2',
            page_id_variant: 'VARIANT_ID_2',
            product_name: 'PRODUCT NAME 2',
            quantity: QUANTITY,
            unit_price: PRICE
        }]
    }
    tracker.trackCheckout(orderFeed);

}catch(e){window.console && window.console.log(e)}}());
</script>

So far I have added the Script tag into my app.tsx as such

<>
 <Script
    src="//static.powerreviews.com/t/v1/tracker.js"
    strategy="afterInteractive"
   />
 <div id="app-root">
    ......
 </div>
</>

So the question is, how can I call the function in a separate component?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!