install Segment on WordPress
add that code to a js in your theme folder (or child theme if you’re using it). for this example I named the script “analytics.js” and put it in a directory called “js” in my child theme folder. Now register and enqueue the file by placing this code in your functions.php function wpse_load_script() { // … Read more