Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

gtag.js Implementation - Global & Event

Avatar

Avatar
Validate 1
Level 1
chrisc97334336
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
chrisc97334336
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
chrisc97334336
Level 1

27-08-2018

Hello Adobe DTM Community,

Reaching out to see if anyone can provide some guidance on the implementation of the gtag.js global (base) and event tag. As the event tag pulls in page data layer values these tags have been implemented as non-sequential JS tags. As the global tag needs to fire first, a page rule has been set up to fire the global tag at the bottom of the page, and a separate page rule set up to fire the event tag on page load. With this configuration I am running into the issue where "gtag" is undefined when the event tag fires. Any assistance regarding this implementation will be very appreciated. 

Global:

DTM.loadScriptCallback("https://www.googletagmanager.com/gtag/js?id=AW-12345678", function() {

    window.dataLayer = window.dataLayer || [];

    function gtag() {

        dataLayer.push(arguments);

    }

    gtag('js', new Date());

    gtag('config', 'AW-12345678');

    gtag('config', 'DC-87654321');

});

Event:

var productID = DTM.getVariable("product")[0].productInfo.productID;

    gtag('event', 'page_view', {

        'send_to': 'AW-12345678',

        'ecomm_prodid': productID

    });

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 4
LeoS_Taco
Level 4

Likes

63 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 4
LeoS_Taco
Level 4

Likes

63 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
LeoS_Taco
Level 4

28-09-2018

I believe you would place the first tag in a page load rule's JavaScript/Third Party Tags section. And then you place the Event rule in the any particular event Javascript/Third Party Tags section. Does that make sense?

Answers (0)