Title: PHP WordPress call in Javascript
Last modified: August 19, 2016

---

# PHP WordPress call in Javascript

 *  [duncan](https://wordpress.org/support/users/duncan/)
 * (@duncan)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-wordpress-call-in-javascript/)
 * I’ve been trying to implement a WP php call in Google Analytics code as described
   on this site
    [http://marketingtechblog.com/2009/03/12/how-to-track-by-author-with-google-analytics/](http://marketingtechblog.com/2009/03/12/how-to-track-by-author-with-google-analytics/)
 * No matter what I try, WordPress doesn’t see the php is the js itself
 *     ```
       var pageTracker = _gat._getTracker("UA-XXXXXX-X");
       pageTracker._initData();
       <?php if (is_single()) { ?>
       pageTracker._trackPageview(”/author/<?php the_author() ?>”);
       <? } ?>
       pageTracker._trackPageview();
       ```
   
 * even stripping out the single call, the author call isn’t seen either
 *     ```
       var pageTracker = _gat._getTracker("UA-XXXXXX-X");
       pageTracker._initData();
       pageTracker._trackPageview(”/author/<?php the_author() ?>”);
       pageTracker._trackPageview();
       ```
   
 * The render works, but it doesn’t insert the `<?php the_author() ?>` like it wasn’t
   there.
 * Any ideas as to why WordPress would be ignoring the php call in the js?
 * thx

The topic ‘PHP WordPress call in Javascript’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [duncan](https://wordpress.org/support/users/duncan/)
 * Last activity: [17 years, 2 months ago](https://wordpress.org/support/topic/php-wordpress-call-in-javascript/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
