Google Analytics on AMP Story - google-analytics

can anyone help me to put google analytic code on amp story? Amp-story does not support GA code? I have put it like this.
<amp-analytics type="gtag" data-credentials="include">
<script type="application/json">
{
"vars" : {
"gtag_id": "G-XXXXXXXXXX",
"config" : {
"G-XXXXXXXXXX": { "groups": "default" }
}
}
}
</script>
</amp-analytics>
But it seems does not work.

Please add AMP analytic script first. Following is the google sample AMP snippet.
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<amp-analytics type="gtag" data-credentials="include">
<script type="application/json">
{
"vars" : {
"gtag_id": "<GA_MEASUREMENT_ID>",
"config" : {
"<GA_MEASUREMENT_ID>": { "groups": "default" }
}
}
}
</script>
</amp-analytics>
Also read following.
https://developers.google.com/analytics/devguides/collection/amp-analytics

I have got the issue. Amp Story does not support Google Analytic 4 yet. If we use UA-XXXXXXX-X this code it works but G-XXXXXXXXXX does not work.

Related

google.translate.SectionalElement is not a constructor

Did Google remove google.translate.SectionalElement?
Сode like below stopped working:
<script>
function googleSectionalElementInit() {
new google.translate.SectionalElement({
sectionalNodeClassName: 'can-translate',
controlNodeClassName: 'translation-control',
}, 'google_sectional_element');
}
</script>
<script src="https://translate.google.com/translate_a/element.js?cb=googleSectionalElementInit"></script>
Maybe there was some announcement that they stopped supporting it?

How to pass dynamic values to <amp-analytics> var

I need to pass the pagePath value dynamically into my amp-analytics tag's var value. Can you please advise how i can achieve this. For example, In the below code snippet , I need to replace the pagePath with different values based on the current page path.
<amp-analytics config="https://www.googletagmanager.com/amp.json?id=xxxxxxxxx&gtm.url=SOURCE_URL" data-credentials="include"
<script type="application/json">
{
"vars" : {
"pagePath" : { Needs to be passed dynamically }
}
}
</script>
<amp-analytics>
You would use variable substitution (https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md).
The variable you're interested in is "Canonical Path" (https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md#canonical-path).
You would insert the string ${canonicalPath} wherever you want it to be templated in before the analytics request is sent. For example:
<amp-analytics config="https://www.googletagmanager.com/amp.json?id=xxxxxxxxx&gtm.url=SOURCE_URL" data-credentials="include"
<script type="application/json">
{
"vars" : {
"pagePath" : "${canonicalPath}"
}
}
</script>
<amp-analytics>

Tag assistant extension for AMP analytics

I tried to record a flow for my website using tag assistance extension, but it seems that it doesn't work with AMP analytics.
Could anyone help me or suggest any similar tool to do this record.
i'm trying to test if google analytics filter "to block our internal traffic" work or not. cause i tested it in google analytics and it seems that the traffic goes to the real time.
I found a solution for my problem
- we just need to send something like this
<amp-analytics type="googleanalytics">
<script type="application/json">
{
"vars": {
"account": "UA-XXXXX-Y",
"anonymizeIP": ""
},
"triggers": {
"trackPageview": {
"on": "visible",
"request": "pageview"
}
}
}
</script>
</amp-analytics>
-We should send "anonymizeIP": "" to make google pick up the user ip and then the filter will work.

Google AMP and Google Analytics

Is this the correct coding to add into my Google AMP article? I tried to submit to Google AMP and there is no error but the article will not come out in the Google Analytics when I browse my article from my handphone.
<amp-analytics type="googleanalytics">
<script type="application/json">
{
"vars": {
"account": "UA-XXXXXX"
},
"triggers": {
"trackPageview": {
"on": "visible",
"request": "pageview",
"vars": {
"title" : "GAMP-"+ "Title of my page"
}
}
}
}
</script>
</amp-analytics>
Please refer to documentation available at
Google amp-analytics documentation
You will need to include the script reference in the head of your html document. Your whole amp html page will need to be validated as well. I suggest going through the starting documentation to create your first google-amp validated page and then add the analytics. Find that guide here
Hello World Google-amp

Fullcalendar synchronization with Google Agenda

I'm trying to include a FullCalendar into a website, synchronized with Google Agenda. I call the function like this:
$(document).ready( function() {
$('#calendar').fullCalendar({
events: { url: "http://www.google.com/calendar/feeds/laporte.julie%40gmail.com/public/basic" }
});
});
The calendar is shown well, but not the data into it. My config in Google Agenda is good. Could someone help me please ?
Do you include: ?
<script type='text/javascript' src='fullcalendar/gcal.js'></script>
You can reference here : http://arshaw.com/fullcalendar/docs/google_calendar/ for more info on the subject.

Resources