Tagged: chat widget
-
AuthorPosts
-
September 27, 2023 at 7:05 am #1420659
HI I need to add the following Javascript to my website, but I can no longer find where to ad the code in Enfold.
I tried adding it inside the Google Analytics Tracking Code field in Enfold Settings but it doesn’t show the widget on the frontend.Any help?
<!– Start of Async Drift Code –>
<script>
“use strict”;!function() {
var t = window.driftt = window.drift = window.driftt || [];
if (!t.init) {
if (t.invoked) return void (window.console && console.error && console.error(“Drift snippet included twice.”));
t.invoked = !0, t.methods = [ “identify”, “config”, “track”, “reset”, “debug”, “show”, “ping”, “page”, “hide”, “off”, “on” ],
t.factory = function(e) {
return function() {
var n = Array.prototype.slice.call(arguments);
return n.unshift(e), t.push(n), t;
};
}, t.methods.forEach(function(e) {
t[e] = t.factory(e);
}), t.load = function(t) {
var e = 3e5, n = Math.ceil(new Date() / e) * e, o = document.createElement(“script”);
o.type = “text/javascript”, o.async = !0, o.crossorigin = “anonymous”, o.src = “https://js.driftt.com/include/” + n + “/” + t + “.js”;
var i = document.getElementsByTagName(“script”)[0];
i.parentNode.insertBefore(o, i);
};
}
}();
drift.SNIPPET_VERSION = ‘0.3.1’;
drift.load(‘x8aa6hymtkax’);
</script>
<!– End of Async Drift Code –>Thank you so much!
Antonio
September 27, 2023 at 7:13 am #1420661I seem to have found where to place the javascript, i.e. in the “Header & footer” plugin installed on the site and it looks like the chat widget is now loading?
September 27, 2023 at 7:15 am #1420662Hey Antonio,
Thank you for the inquiry.
You can add the script using action hooks in the functions.php file.
Example:
// custom script: hide the tooltip on the tab click function ava_custom_script_hide_tooltip() { ?> <script type="text/javascript"> // script goes here </script> <?php } add_action( 'wp_footer', 'ava_custom_script_hide_tooltip', 9999 );
You can also use the following functions.
// https://developer.wordpress.org/reference/functions/wp_add_inline_script/
// https://developer.wordpress.org/reference/functions/wp_head/Another option is to add the script directly in a template file such as header.php or footer.php.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.