Ankur Aggarwal
Ankur Aggarwal

Reputation: 3101

UTM Source Forwading on all links on AMP Page

I want to forward UTM source tracking on all the links on an amp page if UTM is present on the page URL itself.

Example: If UTM is present on some page abc.amp?utm_source=someSource then I want to track the UTM on the links of this page also. The best way would have been cookie (Since it can be tracked along multiple pages) but since AMP doesn't support Cookies and JS solution, any idea how to achieve this???

Upvotes: 1

Views: 1275

Answers (2)

Eric Korolev
Eric Korolev

Reputation: 743

For passing UTM parameters from one page to another use this

<script>
    $('a').each(function(i, el){
        $(this).attr({
            href: $(this).attr("href") + window.location.search
        });
    });
</script>

Upvotes: 0

user9465874
user9465874

Reputation:

You would need to use QUERY_PARAM and add the UTM to each clickable link in your pages. Alternatively, you could use amp-bind, and fire off to an API end-point, using the CLIENT_ID as reference of the initial UTM data, and save it to your database. You would then be able to see where a user came from (for your own sources), and if you are using Google Tag Manager, see what their activity was going through your site as well.

Upvotes: 0

Related Questions