Included External Js in Yii

Hi friends!

My customer bought a project prepared with Yii.

I met with Yii and Everything is perfect.

I have a small problem and I didn’t find any solutions yet.

I have seo tracking script with core php.

I must add my code in view/main.php

But I didn’t find any solutions, how can i add this code for my main.php.

Generally

Usually added this code in footer.php for core php projects.

I hope you can help me about this problem. Thank you.

Open file with -Assets suffix in assets/ folder (usually AppAsset.php) and add your js file in $js var:




    public $js = [

         // ...

         'https://domain/seo/js/analytics_js/client.js',

    ];



Thank you friend! Even you wrote me on stackoverflow.

But this doesn’t work for me. I must add id=“domain” data-name=“6208315” values for external script.