Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9133953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:34:38+00:00 2026-06-17T08:34:38+00:00

I want to put a GTM container on my webpage, just to add scripts

  • 0

I want to put a GTM container on my webpage, just to add scripts without modify html of my page (I will no longer have acces).

1)Currently, I just put the GTM code after , created a tag on my GTM account (tag type = GA), added UA-XXXXX-Y of my GA account : it’s work, I can see visit from my GA acc.

2)Then, I tried to change the type of my tag created on GTM : I choose Custom HTML type, and I put the code given by GA (with correct UA)

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-Y']);
_gaq.push(['_setDomainName', 'example.com']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

It’s work too, I see visit from GA interface

3) I want to modify the code given by GA, especially add trackPageview with param (using server variable, here’s my problem…)

So I just modified code that I used in 2), just adding :

_gaq.push(['_trackPageview', '/Page1/$!{VAR}/Page2/$']);

and it doesn’t work.

Did I do something wrong? Should I use macro?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:34:39+00:00Added an answer on June 17, 2026 at 8:34 am

    Serverside variables are not going to work with GTM (since the code is inserted via javascript from a different server) so yes, a macro ist the way to go.

    Create a data layer (a JSON var that is inserted after the opening body tag just before the GTM tag:

    <script>
    dataLayer = [{    
        'myVar': '{VALUE INSERTED BY SERVER }'
    
    }];
    </script>
    

    Now you can access myVar as a macro in GTM ( “{{myVar}}” ):

    _gaq.push(['_trackPageview', '{{myVar}}']);
    

    This also works with the GA tag template in GTM (there is an option to insert a virtual url, you can use macros there).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want put tracking pixel on 3rd party html file, which will call a
I have a page layout for my MOSS '07 site that I want put
hey, hi i want put limit on object creation means a class can have
I want to put two side by side on another (I have three )
I have a RadioGroup and two RadioButtonField added in a VerticalFieldManager. I want put
I want to put a link in a button that goes to last page.
I have cross-tab and i want put second cross-tab to right side, but i
i have this <p class=comment_date title=a>c</p> <p class=comment_date title=b>b</p> i want put the title
Suppose, I have very large foreach loop. I want put this loop into try
Here is my HTML <div id=test>There I dont want put button</div> and my CSS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.