TronShop allows you to extend the functionality and customize the appearance of your e-shop using custom HTML, CSS, and JavaScript through the External Scripts feature.
In addition to the standard visual settings available in the TronShop administration, external scripts provide greater flexibility when creating a unique e-commerce experience tailored to your business needs.
On This Page
- External Scripts
- Accessing External Scripts
- External Script Configuration
- Cookie Tags
- Code Editor
- Supported Placeholders
- Saving and Testing Your External Script
- Troubleshooting External Scripts
External Scripts
The External Scripts feature allows you to insert custom code directly into your TronShop storefront without modifying the core platform code.
External scripts can be used for various purposes, including:
- Visual customization: Modify the appearance, layout, typography, colors, and other visual elements using CSS.
- Enhanced functionality: Extend the existing storefront functionality using JavaScript.
- Analytics and tracking: Implement analytics, conversion tracking, and marketing tools.
- Third-party integrations: Integrate external services such as live chat, customer support widgets or marketing platforms.
- Custom HTML elements: Insert additional content or supported third-party components into your storefront.
Accessing External Scripts
To access the External Scripts feature, navigate to the following section in your TronShop administration:
Settings → Advanced Functions → External Scripts
The External Scripts overview displays all external scripts currently configured in your TronShop.
For each external script, the overview provides the following information:
- State: Current activation status of the script.
- Name: Name assigned to the script.
- Code: Preview of the script source code.
- Script target: Defines where and for which users the script runs.
- Script position: Position of the code within the HTML document.
- Cookie Tags: Assigned cookie consent categories.
- Options: Allows you to edit or delete the script.
Adding a New External Script
To create a new external script, click the green Plus (+) button located below the list of existing external scripts.
This will open the external script configuration and code editor, where you can define the script settings and insert your custom HTML, CSS, or JavaScript code.
Managing Existing External Scripts
To modify an existing external script, click its name or the pencil icon in the Options column.
To remove an external script, click the trash icon in the Options column.
TIP
If you only need to temporarily deactivate an external script, we recommend changing its State to Disabled instead of deleting it. This allows you to preserve its configuration and source code for future use.
External Script Configuration
The external script editor is divided into two main sections:
- Where and when it runs
- Code
Where and when it runs
This section allows you to define the script name, activation status, target pages, position within the HTML document, and applicable cookie consent categories.
Name
Enter a descriptive name for your external script. We recommend using a name that clearly identifies its purpose, especially if you manage multiple external scripts.
Examples:
- Custom CSS
- Homepage Customization
- Google Tag Manager
- Live Chat Integration
- Custom Product Page Script
State
The State setting determines whether the external script is active on your storefront.
- Enabled: The script is active and will be inserted into the storefront according to its configuration.
- Disabled: The script is inactive and will not be inserted into the storefront.
Disabling a script allows you to temporarily deactivate it without deleting its configuration or source code. This can be particularly useful when troubleshooting storefront issues.
Script target
The Script target setting determines where and for which users the external script will be rendered.
For example, selecting Every Page - Every User means that the script will be inserted into every storefront page for all users, subject to the applicable cookie consent settings.
Always select the most appropriate target according to the purpose of your script. Avoid loading scripts on pages where their functionality is not required.
Script position
The Script position setting determines where the code will be inserted within the HTML document.
The following options are available:
-
In Head Section
The code is inserted into the HTML
<head>section.This position is generally suitable for CSS stylesheets and integrations that require early initialization. Depending on the implementation, scripts loaded in this position may affect the initial page loading performance.
-
Before Body End
The code is inserted before the closing
</body>tag.This position is generally suitable for JavaScript that interacts with existing page elements or does not require early initialization.
When implementing a third-party integration, always follow the script placement instructions provided by the respective service provider.
Cookie Tags
When implementing external scripts in your TronShop, pay particular attention to the Cookie Tags settings.
The following cookie consent categories are available:
- Performance
- Analytics
- Marketing
Cookie Tags allow you to associate an external script with the corresponding cookie consent category.
If a script is assigned to a cookie category, its loading depends on the visitor's consent to that category.
For example, if you select the Marketing checkbox, the script will only be loaded when the visitor grants consent to marketing cookies through the cookie consent banner or cookie settings.
For purely visual customizations that do not perform tracking, store non-essential cookies or process visitor data for analytics or marketing purposes, a cookie tag may not be necessary.
IMPORTANT
Always classify external scripts according to their actual functionality and applicable privacy requirements.
Do not leave tracking or marketing scripts unclassified solely to bypass the visitor's cookie consent preferences.
The website operator is responsible for ensuring that implemented third-party scripts comply with applicable cookie consent and data protection requirements.
Code Editor
The Code section allows you to insert and manage the source code of your external script.
The code is inserted into the storefront HTML according to the selected script target, position, state and cookie consent settings.
You can insert HTML, CSS and JavaScript code. Inline CSS and JavaScript must be enclosed in their appropriate HTML tags.
CSS example
CSS can be used to customize the appearance of existing storefront elements.
<style>
.custom-element {
color: #333333;
font-size: 16px;
}
</style>JavaScript example
JavaScript can be used to implement custom behavior, interact with storefront elements or initialize third-party integrations.
<script>
document.addEventListener('DOMContentLoaded', function () {
console.log('Custom TronShop script loaded.');
});
</script>HTML example
HTML can be used to insert additional elements into the storefront. When inserting visible HTML elements directly, select a position within the document body.
<div class="custom-element"> Welcome to our e-shop! </div>
These examples are provided for illustrative purposes. The actual implementation depends on your storefront structure and customization requirements.
Supported Placeholders
The External Scripts editor provides a selection of supported placeholders that allow you to access dynamic TronShop data within your custom code.
Click on a supported placeholder to insert it directly into the code editor at the current cursor position.
Additional information about the available placeholders can be accessed by clicking Show details.
The availability of individual placeholders depends on the selected script target and the relevant storefront context.
Shopping Cart
Shopping cart placeholders are available for scripts configured to run on every page.
| Placeholder | Description |
|---|---|
{{SHIPPING_NAME}} |
Selected shipping method name |
{{SHIPPING_PRICE}} |
Shipping price |
{{PAYMENT_NAME}} |
Selected payment method name |
{{PAYMENT_PRICE}} |
Payment price |
{{DATALAYER_ITEMS}} |
Data layer items block for supported integrations |
These placeholders can be useful when implementing shopping cart-related functionality, analytics or supported e-commerce tracking integrations.
Confirmed Order
Confirmed order placeholders are intended for scripts configured to run on the order confirmation page.
They can be used when implementing supported order-related integrations and conversion tracking.
The available placeholders depend on the selected script target. Refer to the Supported Placeholders section in the administration for the applicable options.
Signed-in Customer
These placeholders provide access to selected information about the signed-in customer.
| Placeholder | Description |
|---|---|
{{USER_EMAIL}} |
Customer email address |
{{USER_FIRSTNAME}} |
Customer first name |
{{USER_LASTNAME}} |
Customer last name |
{{USER_LOGIN}} |
Customer login |
Cookie Consent
Cookie consent placeholders provide information about the corresponding cookie consent categories.
| Placeholder | Description |
|---|---|
{{ALLOWED_COOKIES_MARKETING}} |
Marketing cookie consent |
{{ALLOWED_COOKIES_TRACKING}} |
Tracking cookie consent |
{{ALLOWED_COOKIES_PERFORMANCE}} |
Performance cookie consent |
When using placeholders in custom code, refer to the detailed information available in the administration and ensure that your implementation correctly handles the returned values and any unavailable data.
DATA PRIVACY AND SECURITY
Some placeholders may contain personal customer information. Always ensure that any processing or transfer of such data to third-party services complies with applicable data protection and privacy requirements.
External scripts are inserted into the storefront HTML and may be accessible to website visitors through their browser developer tools.
Never include confidential API keys, passwords, private access tokens, or other sensitive credentials in client-side external scripts.
Saving and Testing Your External Script
Once you have completed the configuration and inserted your code, click Save to apply your changes.
We recommend following these steps after implementing or modifying an external script:
- Verify that the script State is set to Enabled.
- Verify the selected Script target and Script position.
- Check the applicable Cookie Tags.
- Save your changes.
- Open your TronShop storefront and reload the page.
- Verify that the script provides the expected functionality.
- Test the affected pages on desktop and mobile devices.
- Check the browser developer console for potential JavaScript errors.
- If applicable, test the script with different cookie consent preferences.
When testing external scripts, we recommend using a private or incognito browser window to help eliminate the influence of previously stored cookies, cached content, and browser session data.
Troubleshooting External Scripts
If an external script does not work as expected, verify the following before contacting Technical Support:
- Script activation: Ensure that the script is enabled.
- Script target: Verify that the script is configured to run on the affected page and for the relevant user type.
- Script position: Verify that the selected position is appropriate for the implementation.
- Cookie consent: Ensure that the required cookie categories have been accepted.
- Code syntax: Check for missing HTML tags, invalid CSS syntax, or JavaScript errors.
- Third-party dependencies: Verify that any required external resources or services are available.
- Script conflicts: Check whether other external scripts interfere with the affected functionality.
If the script causes unexpected behavior, temporarily change its State to Disabled and review its source code before enabling it again.
If you suspect a conflict between multiple external scripts, temporarily disable the suspected scripts individually and test the storefront after each change.
TIP
We recommend organizing external scripts according to their individual purpose rather than combining unrelated customizations into a single script.
This makes your customizations easier to maintain, troubleshoot, and temporarily deactivate if necessary.
To reduce the performance impact of custom scripts, consider minifying production CSS and JavaScript, avoiding unnecessary external dependencies, and using asynchronous or deferred loading for external JavaScript where appropriate.
Always respect script dependencies, initialization requirements, and cookie consent settings, and test the storefront after making changes.
Keep in mind that excessive or poorly optimized external scripts may negatively affect website performance, loading times, security, and storefront functionality.
IMPORTANT: BACKUP AND MAINTENANCE
Always maintain a backup of your external scripts, including scripts implemented by the PromoTron team.
Take extra care when modifying existing source code.
Modifying external scripts without sufficient knowledge of HTML, CSS and JavaScript may compromise individual features or affect the functionality of your entire TronShop.
External scripts may also depend on the existing storefront structure. Future platform updates may therefore require adjustments to individual customizations.
PromoTron does not take responsibility for issues caused by incorrect modifications or unauthorized interventions in external scripts performed on the customer's side.
If an external script is damaged due to such modifications, PromoTron reserves the right to charge a fee for restoring its original functionality.
NEED HELP?
If you do not have an internal IT specialist or an external contractor who can assist you with TronShop customization and external script implementation, PromoTron offers an Individual Customization service.
Please contact our Sales Department for further information and an individual quotation based on your requirements.
Individual customizations require technical assessment, implementation, and testing. The scope, feasibility, and estimated development time depend on the complexity of the requested functionality.
More information can be found in the following article: Individual Customizations.
Comments
0 comments
Please sign in to leave a comment.