How to add Digioh JavaScript to PrestaShop

PrestaShop is an online platform that allows users to create an e-commerce presence, enabling them to sell products and services through the web to an online audience.

Follow these steps to install the Digioh JavaScript on your PrestaShop site.

1) Get the Digioh Script

Log into your Digioh account and copy the JavaScript snippet.

2. Add script to PrestaShop

Go to [Your Website] => ./controllers/front/IndexController.php

Inside initContent() function paste this code:

$this->context->controller->registerJavascript(
'monurl',
'https://js.example.com/files/test.js', // Your external javascript file
array('server' => 'remote', 'position' => 'bottom', 'priority' => 150)
);

Note: Replace the JS file link Digioh Script link

Also note that [‘server’ => ‘remote’] is the required attribute, otherwise your remote file will not work

Replace the URL in the 2nd attribute with your JavaScript file

The initContent() function will look like this:

public function initContent()
 {
 parent::initContent();
 $this->context->controller->registerJavascript(
 'monurl',
 'https://js.example.com/files/test.js', // Your external javascript file
 array('server' => 'remote', 'position' => 'bottom', 'priority' => 150)
);
 $this->context->smarty->assign([
 'HOOK_HOME' => Hook::exec('displayHome'),
 ]);
 $this->setTemplate('index'); 
 }

The Digioh JavaScript is now added to your PrestaShop site. If you make any changes to your website or migrate to a new platform, be sure to verify that your Digioh JavaScript is still present and running. If it is not, your Digioh campaigns will stop functioning and data collection will be interrupted until the script is restored.

If you have any questions about adding Digioh to PrestaShop, send us a message.

Want to get more from Digioh?

Get the playbooks leading brands use to convert more visitors into revenue.

Browse the Playbooks ?

Platform Tour

See what else you can do with Digioh in our self-guided platform tour.

Take the Tour ?

Still Need Help?

Connect with our team for technical help.

Message Support