web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / javascript function in...
Power Apps
Unanswered

javascript function in PCF

(0) ShareShare
ReportReport
Posted on by 4

Hi,

Is there any documentation or video on implementing the javascript function in PCF so that it can be used in a canvas app. I have a javascript function, but not sure where should I add it inside PCF.

 

I have the same question (0)
  • cchannon Profile Picture
    4,702 Moderator on at

    A pcf is intended for adding elements to the DOM. I suppose you can just use it to process logic and return an empty div, but why? What logic do you need to do in Js that you can't do in Power Fx, or Flows?

  • uzol1 Profile Picture
    4 on at

    Thank you @cchannon for your response. I would need to run a function provided by a third party app called FullStory so that the insights of the user activity would be recorded. Please let me know if you have any other idea than PCF to achieve this.

     

  • cchannon Profile Picture
    4,702 Moderator on at

    Yeah, you can absolutely do it with a PCF. here are a couple examples of doing the same thing with Microsoft Clarity (their free competitor to FullStory):

     

    https://www.m365princess.com/blogs/power-apps-microsoft-clarity-pcf/

    https://grazfuchs.net/post/canvasappsclarity/

     

  • uzol1 Profile Picture
    4 on at

    Thank you @cchannon for the link. Its really helpful. However the snippet function provided by FullStory does not seem to work in the init method in PCF. Here is the code provided by them: 

    <script>
    window['_fs_host'] = 'fullstory.com';
    window['_fs_script'] = 'edge.fullstory.com/s/fs.js';
    window['_fs_org'] = 'FEH9J';
    window['_fs_namespace'] = 'FS';
    (function(m,n,e,t,l,o,g,y){
        if (e in m) {if(m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');} return;}
        g=m[e]=function(a,b,s){g.q?g.q.push([a,b,s]):g._api(a,b,s);};g.q=[];
        o=n.createElement(t);o.async=1;o.crossOrigin='anonymous';o.src='https://'+_fs_script;
        y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);
        g.identify=function(i,v,s){g(l,{uid:i},s);if(v)g(l,v,s)};g.setUserVars=function(v,s){g(l,v,s)};g.event=function(i,v,s){g('event',{n:i,p:v},s)};
        g.anonymize=function(){g.identify(!!0)};
        g.shutdown=function(){g("rec",!1)};g.restart=function(){g("rec",!0)};
        g.log = function(a,b){g("log",[a,b])};
        g.consent=function(a){g("consent",!arguments.length||a)};
        g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)};
        g.clearUserCookie=function(){};
        g.setVars=function(n, p){g('setVars',[n,p]);};
        g._w={};y='XMLHttpRequest';g._w[y]=m[y];y='fetch';g._w[y]=m[y];
        if(m[y])m[y]=function(){return g._w[y].apply(this,arguments)};
        g._v="1.3.0";
    })(window,document,window['_fs_namespace'],'script','user');
    </script>

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard