Share This Post

Ask For Help

Help me Validate Alexa Script

I am looking for someone to help with me a valid Alexa Script, I have tried contacting Alexa customer support but they don’t have a solution.

Following is the script provided by them, but if you run it through W3C validator, it fails since you cannot include an img tag in head.

<!– Start Alexa Certify Javascript –>
<script type=”text/javascript”>
_atrk_opts = { atrk_acct:”PM8Yj1a0Sn00X3“, domain:”printawallpaper.com”,dynamic: true};
(function() { var as = document.createElement(‘script’); as.type = ‘text/javascript’; as.async = true; as.src = “https://d31qbv1cthcecs.cloudfront.net/atrk.js”; var s = document.getElementsByTagName(‘script’)[0];s.parentNode.insertBefore(as, s); })();
</script>
<noscript><img src=”https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=PM8Yj1a0Sn00X3″ style=”display:none” height=”1″ width=”1″ alt=”” /></noscript>
<!– End Alexa Certify Javascript –>

I don’t want to add the script to body tag, so any suggestions or help would be highly appreciated.

Comments

Share This Post

7 Comments

  1. What is the purpose of this script?

  2. Mansoor the script is used to validate and collect data on alexa.com a popular analytic tool and global ranking system.

  3. You mean you want to verify your website so that alexa show data?

    I have validated many sites with simple technique but this seems to be complected.

    Once you put website on alexa.com they give alternatives along with above code to verify website.

    Download the file and upload it on root of your web server that’s it. Need to change or implement any new code to any file.

    Note: Alexa is does not show accurate data also it shows 3 months average ranking. You will know by the time.

    If you have any doubt check my profile first…

    Cheers!!

  4. Mansoor, this is not a ownership validation code, its like a good analytic code that collect data and send it to alexa server. If i remove this code, Alexa will not be able to gather stats related to visits etc on my website. Similar to Google analytics, if we remove the code the analytic account will stop working. Its a paid server by Alexa.

  5. A little more detail as to the Hosting and development platform used for the Site mentioned, for the Alexa code to be added would be more helpful while troubleshooting and suggesting.

    Have seen this issue with some Pre made (ready to use) Hosting platforms where they do not permit such scripts on their platforms to make websites, you would need root access for installing hosting requirements like javascripts, also it may differ if you are using WP, PHP or any other language for the site as well for development, here is one php example and one for WP which might be helpful to understand since it is a Javascript it can be used in many ways if you do not want it to be added to the body tag as well. 

    Hope this helps!!!

  6. Darshan,

    There is problem with the script, It would not validate with a plan vanilla html. Since the img tag that is available along with the script doesn’t validate in head.

    Regards,

    Amit

  7. If this is how it is supposed to work correctly, it is pretty simple to understand the use of the overall code which Alexa required to be inserted.

    The gif file <href=”https://d5nxst8fruw4z.cloudfront.net/atrk.gif&gt”> is a tracking image file (Size 1×1) so that the Alexa can measure and rank with the ones getting downloaded on every page link visits for your site with its presence, adding a +1 to the counter, with the code <account=PM8Yj1a0Sn00X3> registered for the site <domain:”printawallpaper.com”> to keep it dynamic in this regards.

    It is stated to : Paste the code snippet into EVERY page of your website just below the opening <body> tag in the HTML

    Not <Head> (Which you are repeatedly mentioning) without describing the language of programming used and hosting employed to do it as well.

    If you checked the links posted in my earlier comment (for two of the most popular languages of web development domain viz PHP and WP), it shows how to use it in sub themes, or as a widget. Self explanatory.

    You can also employ many other ways to have the script so it is visible and tracked on Every page individually or via some elements which repeat on every page (as a master) of your site to attain this functionality and needs only one time editing, being a Web design and Developer yourself to resolve this.

    Try to put your Alexa code script (exact format as received from their end) next to your Google Analytics code!

    (in Theme settings there is field for Analytics code, try to insert after it Alexa code) because you can change it without modifying the theme files.

    If you feel there is a problem with the script as provided Plain Vanilla HTML or modified on your end, connect with the Alexa Customer support to check if it requires any updation or changes likewise too, they do this innumerable times daily also check their faqs which should define the exact way to get this done as well for your preferred use of development language used or hosting partner as well for that purpose with required admin access etc involved likewise, since others using it would definitely be doing the same thing (have done this for my own websites in the past too, worked in most cases without any hitch, though takes some time to update on the server side the first time)

    Would leave it for the Web Specialists to follow up after this though 🙂 Good Luck!!!

Comments are now closed for this post.

Lost Password

Register