Title: AMP Google Analytics Plugin
Last modified: September 1, 2016

---

# AMP Google Analytics Plugin

 *  [mchauta](https://wordpress.org/support/users/mchauta/)
 * (@mchauta)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/amp-google-analytics-plugin/)
 * I’m very new to wordpress plugin editing so be kind 😉
 * I’ve created an admin setting page so that users can input their GA tracking 
   code and I have it saved. I want to populate into their amp pages. Problem is
   I don’t know how to actually bring in the tracking code there. Here is the analytics
   code in the template where I need it to show up:
 *     ```
       <script async custom-element="amp-analytics"
           src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
   
       <amp-analytics type="googleanalytics" id="analytics1">
           <script type="application/json">
       {
         "vars": {
           "account": "UA-XXXXXXX-XX"
         },
         "triggers": {
           "trackPageview": {
             "on": "visible",
             "request": "pageview"
           }
         }
       }
           </script>
       </amp-analytics>
       ```
   
 * I need the tracking code to pull the info from my options. I tried echoing it
   `
   <?php echo $options['ga_account']; ?>` but soon realized that you can’t really
   do that within the script. Can someone point me in the right direction? How do
   I pull an options value into the GA code above without breaking it?
 * Like I said, I’m pretty new to this stuff.

The topic ‘AMP Google Analytics Plugin’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [mchauta](https://wordpress.org/support/users/mchauta/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/amp-google-analytics-plugin/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
