How to extract Android Advertising ID of all Mobile visitors


As you may know, nowadays mobile has been gaining a lot of significance in the minds of Advertisers. One of my clients, wants to extract the Google Advertising IDs of all Mobile Visitors to their site.

Now, I know that extracting the Advertising ID is possible through a straight forward API (See this: Advertising ID - Play Console Help). However, I want to know if it would be possible for me to extract the Android Advertising IDs of all my visitors using the JS file that Piwik uses to track performance.

If anyone can give me broad steps to execute this, or a quotation to modify the JS to be able to extract this, I’d be grateful.

P.S. This is more of an ad-hoc work, so I’m not as inclined towards reporting this in the Dashboard. I just want to record all Advertising IDs in a table alongside a primary key (Like Event ID) for cross reference.