title: Combine amp-analytics for amp-next-page
body: <p>I am currently using the code below to track pageviews on my AMP accelerated pages on a WordPress website:</p>
  <pre><code>    {
      &quot;vars&quot;: {
          &quot;account&quot;: &quot;UA-12345678-1&quot;
      },
      &quot;triggers&quot;: {
          &quot;trackPageview&quot;: {
              &quot;on&quot;: &quot;visible&quot;,
              &quot;request&quot;: &quot;pageview&quot;
          }
      }
  }
  </code></pre>
  <p>I have just implemented infinite scroll on single pages and i need the next-page to be tracked on scroll or click also. I found the below code on the official &quot;amp.dev&quot; page:</p>
  <pre><code> &lt;amp-analytics&gt;
    &lt;script type=&quot;application/json&quot;&gt;
      {
        &quot;requests&quot;: {
          &quot;nextpage&quot;: &quot;https://example.com/pixel?RANDOM&amp;toURL=${toURL}&quot;
        },
        &quot;triggers&quot;: {
          &quot;trackScrollThrough&quot;: {
            &quot;on&quot;: &quot;amp-next-page-scroll&quot;,
            &quot;request&quot;: &quot;nextpage&quot;
          },
          &quot;trackClickThrough&quot;: {
            &quot;on&quot;: &quot;amp-next-page-click&quot;,
            &quot;request&quot;: &quot;nextpage&quot;
          }
        }
      }
    &lt;/script&gt;
  &lt;/amp-analytics&gt;
  </code></pre>
  <p>How can I combine both codes into one such that it can track both pageviews and the infinite scroll (both on-click and on-scroll)</p>