1

AMP 페이지가 구현되었으며 오류없이 색인이 생성되어 Google 검색에 나타납니다. 방문자가 Google SERP에서 링크를 클릭하면 organic/google에서 참조 된대로 Google 웹 로그 분석에 표시됩니다 (캐시 된 페이지 포함). 그러나 방문자가 해당 AMP 페이지의 링크를 클릭하면 리퍼러는 때때로 referral/ampprogect.org이고 많은 경우 direct/none이됩니다.
물론, amp-analytics이 설정됩니다.
캐시 된 페이지에서의 클릭에 대한 응답으로 AMP 페이지가 주 서버에서 제공된 경우 direct/none이 표시됩니다.
며칠 전 AMP가 게시되었지만 지금까지 모두가 발견 된 것은 아닙니다.
의미가 있습니까?
전류 - 분석은 아주 기본적인 방식으로 구현되어Google 웹 로그 분석에서 캐시 된 앰프 페이지의 클릭 수가 직접/없음으로 표시됩니다.

<amp-analytics type="googleanalytics"> 
<script type="application/json"> 
{ 
    "vars": { 
    "account": "UA-XXXXX-Y" //real account id for sure 
    }, 
    "triggers": { 
    "trackPageview": { 
     "on": "visible", 
     "request": "pageview" 
    } 
    } 
} 
</script> 
</amp-analytics> 

내가 AMP에 대한 Google 태그 관리자를 설정하고 같은 결과

<amp-analytics config="https://www.googletagmanager.com/amp.json?id=GTM-zzzzzz&gtm.url=SOURCE_URL" data-credentials="include"></amp-analytics> 

으로 amp-analitics 블록을 변경

업데이트 .
에서 클릭 (즉 https : //mydomain.com/amp/something.aspx이다)를 도시 direct/none 비 앰프 (즉 https://google.com/mydomain-com.cdn...이다)AMP 페이지를 캐시 referral/ampproject.org을 도시 비 캐시 클릭 AMP.

+0

이 [블로그] (http://blog.analytics-toolkit.com/2015/google-analytics-direct-none-source/)를 기반으로 사용자가 내 사이트로 이동하고 Google 웹 로그 분석에서 알지 못하는 경우 사용자가 어디서 왔는지에 따라 세션이 '직접/없음'으로 표시됩니다 (이전 쿠키 데이터에 대한 이전 캠페인 데이터가없는 경우). – abielita

답변

0

덕분에 this great post 무엇이 잘못되었는지 이해하고 아이디어를 .NET에 적용했습니다. 주요 아이디어는 amp-analytics 구성 객체 (JSON 형식)를 잡아 내 자신의 것으로 바꿉니다 (내부는 clientId).
우선 내가 web.config에 등록 된 다음

''//.VB 
Namespace AmpHandlers 
    Public Class AmpConfig 
     Implements IHttpHandler 

     Private Const unixStart As DateTime = #1/1/1970# ''//start of epoc 

     Public ReadOnly Property IsReusable As Boolean Implements IHttpHandler.IsReusable 
      Get 
       Return False 
      End Get 
     End Property 

     Public Sub ProcessRequest(context As HttpContext) Implements IHttpHandler.ProcessRequest 
      context.Response.Clear() 
      ''//ecpected request 
      ''// https : //mydomain.com/gtm-amp.json?id=GTM-zzzzzz&gtm.url=SOURCE_URL 
      If String.IsNullOrEmpty(context.Request.QueryString("id")) OrElse context.Request.QueryString("id") <> "GTM-zzzzzz" Then 
       ''//no answer 
       context.Response.End() 
       Return 
      End If 
      Dim clientId As String = "" 
      If context.Request.Cookies("_ga") IsNot Nothing Then 
       Dim ga As String = context.Request.Cookies("_ga").Value ''//GA1.2.12321354.1507250223 
       clientId = Regex.Match(ga, "(\d+?\.\d+?$)").Groups(1).Value 
      Else 
       Dim rand As New Random() 
       ''//Majic 2147483647 is upper limit of Google's random part of _ga cookie 
       ''//The second part is Unix time, in seconds 
       clientId = rand.Next(2147483647) & "." & CInt(DateTime.UtcNow.Subtract(unixStart).TotalSeconds) 
      End If 
      ''//Set cookie and response headers 
      context.Response.ContentType = "application/json" '; charset=UTF-8 
      context.Response.SetCookie(New HttpCookie("_ga") With {.Value = "GA1.2." & clientId, 
       .Path = "/", .Domain = context.Request.Url.Host, .Expires = DateTime.UtcNow.AddYears(2) 
             }) 
      context.Response.AddHeader("Access-Control-Allow-Origin", "https://mydomain-com.cdn.ampproject.org") 
      context.Response.AddHeader("Access-Control-Expose-Headers", "AMP-Access-Control-Allow-Source-Origin") 
      context.Response.AddHeader("AMP-Access-Control-Allow-Source-Origin", "https://" & context.Request.Url.Host) 
      context.Response.AddHeader("Access-Control-Allow-Source-Origin", "https://" & context.Request.Url.Host) 
      context.Response.AddHeader("Access-Control-Allow-Credentials", "true") 
      context.Response.AddHeader("Content-Disposition", "attachment; filename=""GTM-NZPM27T.json""") 
      context.Response.AddHeader("cache-control", "no-cache, no-store, must-revalidate") 

      ''//https://www.googletagmanager.com/amp.json?id=GTM-zzzzzz&gtm.url=SOURCE_URL response is saved locally and edited 
      ''//possibly it is not the best colution 
      Dim sr As New IO.StreamReader(context.Server.MapPath("~/amp-gtm.config")) 
      Dim str As String = sr.ReadToEnd() 
      str = str.Replace("[[clientId]]", clientId) 
      context.Response.Write(str) 
      context.Response.Flush() 
      context.Response.End() 
     End Sub 
    End Class 
End Namespace 

HttpHandler을 만들었다.

<handlers> 
    <add name="amp-gtm" verb="GET" path="gtm-amp.json" type="AmpHandlers.AmpConfig" resourceType="Unspecified"/> 
</handlers> 

마지막으로 amp-analytics 태그에 넣습니다.

<amp-analytics config="https : //mydomain.com/gtm-amp.json?id=GTM-zzzzzz&gtm.url=SOURCE_URL" data-credentials="include"></amp-analytics> 

이제 캐시 된 캐시 및 캐시되지 않은 AMP 페이지의 모든 클릭은 organic/google입니다.

관련 문제