Hi
I would recommend you to follow official documentation here,
Link:- https://docs.adobe.com/docs/en/aem/6-2/administer/integration/external-providers.html
// Analytics with External Providers
You can configure your own instance of the Generic Analytics Snippets to define a new service configurations.
Creating a new Service with a Generic Snippet
1.Open the Tools console.
2.From the left pane expand Cloud Services Configurations.
3.Double-click on Generic Analytics Snippet to open the page
4.Click on the + to add a new configuration using the dialog; at a minimum assign a name, for example google analytics:
[img]https://docs.adobe.com/content/docs/en/aem/6-2/administer/integration/external-providers/_jcr_conten...
5. Click Create, the snippet dialog will open immediately - paste the appropriate javascript snippet into the field:
6. Click OK.
I hope this will help you.
Thanks and Regards
Kautuk Sahni
Kautuk Sahni