src/GtmHelpers/HtmlHelperExtensions.cs
/// <summary>
/// Generates a Google Tag Manager DataLayer click event script
/// </summary>
/// <param name="htmlHelper"></param>
/// <param name="evnt">Event</param>
/// <param name="category">Categnry</param>
/// <param name="action">Action</param>
/// <param name="label">LAbel</param>
/// <param name="customValues">Custom Tag Values</param>
/// <returns></returns>
Generates a Google Tag Manager DataLayer click event script
Generates a Google Tag Manager DataLayer click event script
public static string GTagEvent(this HtmlHelper htmlHelper, string evnt, string category, string action, string label, object customValues)
        {
            var script = GtmScriptBuilder.GenerateScript(evnt, category, action, label, customValues.ToDictionary<string>());
            if (!string.IsNullOrWhiteSpace(script))
            {
                return script;
            }
            return null;
        }
public static string GTagEvent ( this HtmlHelper htmlHelper , string evnt , string category , string action , string label , object customValues ) { var script = GtmScriptBuilder . GenerateScript ( evnt , category , action , label , customValues . ToDictionary < string > ( ) ) ; if ( ! string . IsNullOrWhiteSpace ( script ) ) { return script ; } return null ; }
Generates a Google Tag Manager DataLayer click event script
Generates a Google Tag Manager DataLayer click event script
None
HtmlHelper
this
evnt
string
None
category
string
None
action
string
None
label
string
None
customValues
object
Custom Tag Values
Custom Tag Values
htmlHelper
None