For marketing reasons, I want to personalize my website based on what ISP/service provider someone is using. Google Analytics/Optimize/GTM do not provide this out of box. ISP/host lookup can be done with PHP, but I need the value in javascript so I can push it to the data layer.
I am not a developer, I've been piecing together bits and pieces from PHP references, Javascript references, and Ajax references.
This is what I have in my (WordPress) header file before closes. My website doesn't crash when it loads, but the javascript variable is constantly empty.
What can I do to pass it as a javascript variable?
<?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); ?>
<script>var jsHostname = <?php $hostname?>;</script>